Hi friends....

I am using SS Tab in my form. There are 4 tabs in total. The user needs to enter a text provided on tab1 and then go to tab2. If the user clicks on tab2 without entering text in the textbox, a message box should be shown to the user and the focus should be set on tab1 again....

Please help me on this....

Thanks,
Dinil

Recommended Answers

All 8 Replies

just try my suggestion...

use if then statement to trap it...
put the codes on the 2nd tab with click action...
put a msgbox...

try this code...

if SStab1.text1.text = "" then
msgbox ("You should Enter Data first on the first tab", vbokonly,"Error") = vbok
SSTab1.setfocus..
end if

hope im right and i did help you....

Note: the name i used in the objects should be changed according to how you named it to your project..

Hi....
I am not able to find the click event of tab2.

sorry about that one.....

try this...

If Text1.Text = "" Then

If MsgBox("You should Enter Required Data", vbOKOnly, "Error") = vbOK Then
SSTab1.Tab = 0
End If

End If

hope this will really help you.....

just make sure in your properties the 1st tab... its TAB property is set to 0
and the next tab is TAB property is set to 1....

hope i did solved your problem......

if i solved your problem... please click the solved link

Hi...
In which event do I put the above piece of code??....
I tried with this:
Private Sub SSTab1_DblClick()
If Text1.Text = "" Then

If MsgBox("You should Enter Required Data", vbOKOnly, "Error") = vbOK Then
SSTab1.Tab = 0
End If

End If

End Sub

This is not working....

Add on click event (you can find combo box filled with sstab event on the top of code window)
This following code will make u can't open other tabs without fill textbox 1 (text1).

Private Sub SSTab1_Click(PreviousTab As Integer)
If Text1.Text = "" Then ' add as u needed
    SSTab1.Tab = 0
End If
End Sub
commented: :twister: +1

Thanks a lot.....
Its working perfectly....
Thanks once again

Cheers,
Dinil

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.