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!

tabchanged property

Status
Not open for further replies.

adev111

Programmer
Jul 8, 2004
44
CA
Hi there,
i have a tabcontrol which has three tabs.
One can not do anything on page 2, if information on page 1 is not entered.
I am thinking of using the function TabControl1_TabIndexChanged but can't really seem to get it working right.
I want to show a msgbox saying that i must enter information on page1, before going to page2.
Can someone give me any suggestions?

Thanks
 
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

If TabPage2.Focus = True Then
//check or validate the user's data input
MsgBox("there are empty fields")
//give the focus to tabpage1 (index=0)
TabControl1.SelectedIndex = 0
End if

End Sub

Should i explain more?
 
Hi there,
i tried as you said but i get An exception
unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Cast from string "0False" to type 'Double' is not valid.

What i m doing is enabl
If (enabl = 0 & (TabPage2.Focus = True)) Then
MsgBox("hiiiii")
End If

I know its something to do with cast. Should i have the enabl to be boolean?

 
Hi there, i got it to work using
If TabControl1.SelectedIndex = 1 Then
If enabl = 0 Then
MsgBox("hiiiii")
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top