Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error

Status
Not open for further replies.

manojk143

Programmer
Apr 30, 2003
4
IN
Hi,

When I am trying to run my VB application I am getting the following error,

Out of Stack Space.

Can anyone please help me in sorting out this error..
 
hehehe your not sorting something are you?

Often this is a sign of a recursive call. This could be from an event that causes another even to be fired and so on.
 
hi,semperfidownunda

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

Robert
 
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.
 
Thanks semperfidownunda and TheVampire for your valuable tips and solutions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top