views:

1129

answers:

1

Hi all,

I'm doing my project and I design including many tab control in vb.net. Example: I have 3 tab pages like tab1,tab2,tab3. And I have menu bar to open tab1,tab2,tab3.

My Question is: How can you use code to open each tab page?

Can anyone help me to solve this problem?

Thanks, Sopolin

+2  A: 

The simplest way is to just handle the OnClick event of your menu buttons and just doing:

Me.MyTabControl.SelectedTab = index;
// 0 = Tab1, 1 = Tab2, 2 = Tab3

Obviously you would replace index with whichever tab you wish to open.

Incase you don't know how to handle the OnClick event, just double click on the button's and the OnClick event is automatically generated for you. Then per button_onclick you just put in the above code, with the index you wish to open when that button is clicked.

James
You don't override the OnClick event. You handle it.
Hugo Riley
Yeah spose in technical terms you are right, updated accordingly :)
James