keymac
asked on
Creating Tab control at runtime in VB.Net
I have created a tab control at run time like this
Public Class Form1
Public sTab As TabControl
Form1_Load
sTab = New TabControl
sTab.Name = "Tab" & ix
sTab.Left = 500
sTab.Width = 1000
sTab.TabPages.Add(New TabPage("Page 1"))
sTab.TabPages.Add(New TabPage("Page 2"))
sTab.TabPages.Add(New TabPage("Page 3"))
Me.Controls.Add(sTab)
End Sub
Now I want to select the a tab page not from clicking on it but from another event such as
Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click
sTab.SelectTab(2)
end sub
End Class
Why is this wrong???
Public Class Form1
Public sTab As TabControl
Form1_Load
sTab = New TabControl
sTab.Name = "Tab" & ix
sTab.Left = 500
sTab.Width = 1000
sTab.TabPages.Add(New TabPage("Page 1"))
sTab.TabPages.Add(New TabPage("Page 2"))
sTab.TabPages.Add(New TabPage("Page 3"))
Me.Controls.Add(sTab)
End Sub
Now I want to select the a tab page not from clicking on it but from another event such as
Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click
sTab.SelectTab(2)
end sub
End Class
Why is this wrong???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For ix = 1 to 4
next
Loop around the creation of the stab code
If you click the button the selected tab does not change