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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab control

Status
Not open for further replies.

thetambarineman

Technical User
Feb 29, 2000
63
0
0
GB
Hello,

can any1 help-im having trouble with the tab control. VB6..
I want to be able to click on a tab - when the tab is clicked i then want the program to go to another form..
Cant find any way to do this.. can anyone help...??

Thanks in advance..

Paul
 
What exactly do you mean by another form. Each tab can be designed the way you want. One thing to keep in mind when working with tabs is that you must draw your controls directly onto the tab. Double clicking attaches the control to the form though it appears to be on the tab.
 
Use the click event of the tab control and test the tab property of the tab control. If the correct tab has been clicked (you will know the tab number that you want the action to take place on) show the other form:

Create a new project with 2 forms (Form1 and Form2) and put an sstab on Form1. Paste the following code into Form1 module:

Option Explicit

Private Sub SSTab1_Click(PreviousTab As Integer)
If SSTab1.Tab = 2 Then
Form2.Show
End If
End Sub


and run the program. Clicking on tab2 will cause Form2 to be displayed.

Simon
 
Hi jpunya
' for a 3 tab SST
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 0
'execute code
Case 1
'execute code
Case 2
'execute code
Case Else
' Do nothing
End Select
End Sub

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top