tabcontrol event called at odd time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I'm curious as to why the following would happen
I have 4 forms that I'm dealing with. On form4 is a tabcontrol (we'll call it tab1)

When form1 is opened, and OK is pressed, form2 opens, when an item is clicked, form3 opens
On form 3 is a menu, and when file, open, and form4 is selected, the tab1_SelectedIndexChanged event is triggered..
I have code in here to deal with when users select different tabs...but why would opening the form trigger it
Obviously I only notice it when I step through the code...is this normal?

Thanks in advance
ambe
 
Hi
hmm yes its normal

try this if you dont want it to triger on load
------------------------------------
Dim isLoad As Boolean = False
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
isLoad = True
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If isLoad = True Then
MsgBox("ok")
End If
End Sub
-----------------------------------

/Jens

amber said:
Hello,
I'm curious as to why the following would happen.
I have 4 forms that I'm dealing with. On form4 is a tabcontrol (we'll call it tab1).

When form1 is opened, and OK is pressed, form2 opens, when an item is clicked, form3 opens.
On form 3 is a menu, and when file, open, and form4 is selected, the
tab1_SelectedIndexChanged event is triggered...
I have code in here to deal with when users select different tabs...but
why would opening the form trigger it?
 
Back
Top