I am using following code... when I comment out this code the application is running... I guess something is wrong with the code I have written.
Private Sub TabLTATran_Click(PreviousTab As Integer)
If CheckValidEmp = False Then
Beep
txtErrMsgBox.Text = "Please Enter A Valid Employee Number!"
TabLTATran.Tab = PreviousTab
Exit Sub
Else
txtErrMsgBox.Text = ""
End If
End Sub
Probably, when you set a tab with code it calls the click event again ( and again, and again, etc. ), which is why you get an Out of Stack Space error.
Try this:
Private Sub TabLTATran_Click(PreviousTab As Integer)
Static Skip as Boolean
If Skip = True Then Exit Sub
If CheckValidEmp = False Then
Beep
txtErrMsgBox.Text = "Please Enter A Valid Employee Number!"
Skip = True
TabLTATran.Tab = PreviousTab
Skip = False
Exit Sub
Else
txtErrMsgBox.Text = ""
End If
End Sub
Like i said you are probably causing an event to fire over and over
TabLTATran.Tab = PreviousTab causes a TabLTATran_Click event to fire
TheVampire has one solution but I would suggest using the validate event to make sure they are valid. Using these type events for validating and getting these events infinately firing off is why they brought in the Validate event.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.