Hi Bart,
On Fri, September 29, 2006 11:08, Bart Pietercil wrote:
> Hi,
>
> this code placed in the change event of a Tabpanel gives me a
> StackOverFlow exception
>
> Sub Change()
> Dim anID As String
>
> if App.TheCoach.SelectedStudent.HasKey("user_id") then
> anID = App.TheCoach.SelectedStudent.Value("user_id")
> if anID = "0" Then
> MsgBox "Nieuwe gebruikers moeten geregistreerd worden bij de
> leverancier vooraleer deze functionaliteit beschikbaar wordt."
> me.Value = 0
> end if
> Else
> me.Value = 0
> end if
> End Sub
>
> What I meant to happen was:
>
> when someone clicks on page 2 (value = 1) and anID = "0" or anID does
> not exist he has to stay on page 1 (value = 0) of the tabpanel.
>
> What am I doing wrong?
>
> TIA
>
> Bart
You've got yourself into a never ending loop because your code triggers
the change event again and then gets called again.
Just put and if statement around the code so that it only runs when the
tab is changed to number 1:
Sub Change()
if me.Value = 1 then
Dim anID As String
if App.TheCoach.SelectedStudent.HasKey("user_id") then
anID = App.TheCoach.SelectedStudent.Value("user_id")
if anID = "0" Then
MsgBox "Nieuwe gebruikers moeten geregistreerd worden bij de
leverancier vooraleer deze functionaliteit beschikbaar wordt."
me.Value = 0
end if
Else
me.Value = 0
end if
end if // only test for tab 1
End Sub
Regards,
--
Ian M. Jones
________________________________________
IMiJ Software
http://www.imijsoft.com
http://www.ianmjones.net (blog)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>