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

Setting the tab # of strip that you want focus on

Status
Not open for further replies.

Catrina

Programmer
Feb 11, 2000
70
US
How can I set the tab that has the focus via code. I have a TabStrip with 4 tabs, and I'm using this sub to control the strip when clicked, but how can I send the sub an Index number via code (tried: TabStrip1.SelectedItem.Index = A%, but it is read only)

Private Sub DoTabLogic()
Dim iCurrTab As Integer

iCurrTab = TabStrip1.SelectedItem.Index

Select Case iCurrTab
Case 1
Frame1(0).Visible = True
Frame1(1).Visible = False
Frame1(2).Visible = False
Frame1(3).Visible = False
Case 2
Frame1(0).Visible = False
Frame1(1).Visible = True
Frame1(2).Visible = False
Frame1(3).Visible = False
Case 3
Frame1(0).Visible = False
Frame1(1).Visible = False
Frame1(2).Visible = True
Frame1(3).Visible = False
Case 4
Frame1(0).Visible = False
Frame1(1).Visible = False
Frame1(2).Visible = False
Frame1(3).Visible = True
End Select
End Sub

Thanks

Catrina

[sig][/sig]
 
TabStrip1.Tab = A%
[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
I thought you could just say:
Code:
Ts1.Tab = 0
To activate the first tab in tab strip Ts1. [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
O.K., IF that's the name of the tabstrip. Her post used &quot;TabStrip1&quot;, which I assumed was/is the control.name for the actual object. Likewise, she used the variable &quot;A%&quot;, so I assumed she wants to use the named variable.

[sig]<p>MichaelRed<br><a href=mailto:mred@duvallgroup.com>mred@duvallgroup.com</a><br>There is never time to do it right but there is always time to do it over[/sig]
 
Hello! I just wana give you some hints by correcting your code in a professional manner. Then you can ask some questions. We suppose that you are not giving any value of tabstrip. Instead using the default stirp. Here is the code

Private Sub DoTabLogic()
Dim intCurrenTab as Integer
intCurrentTab = TabStrip1.SelectedItem.Index

Frame1(0).Visible = IIF(intCurrentTab=0,True,False)
Frame1(1).Visible = IIF(intCurrentTab=1,True,False)
Frame1(2).Visible = IIF(intCurrentTab=2,True,False)
Frame1(3).Visible = IIF(intCurrentTab=3,True,False)
End Sub

P.S: If you are using some variable to pass the value of tab strip then check replace the statement IIF(intCurrentTab=0,True,False) with IIF(intCurrentTab=intVariable,True,False)
 
sorry MichaelRed,

I don't use the variable postfixes (% etc) and didn't read your reply correctly.

Your post was quite correct. [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Personally I would not use
Frame1(0).Visible = IIF(intCurrentTab=0,True,False)

I would just use
Frame1(0).Visible = intCurrentTab = 0
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top