Link to home
Start Free TrialLog in
Avatar of GCCal
GCCal

asked on

how do I use tab control on vb2008

Have a tab control with 6 tabs.  When I click a button I want  tab index 0 to be displayed.  I have tried tabcontrol.selectedindex =0 and tabcontrol.selectedtab= tabpage1.  In both instances, the tab page is not selected unless it is higher than the current selected tab.  For example, if tab page 0 is visible and I use tabcontrol.selectedindex= 3, tab page is displayed properly.  However, if tab page 3 it displayed, and I use selectedindex = 0 then nothing happens.  It only changes if the new selectedindex is higher than the current selectedidnex.  Anyone have any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GCCal
GCCal

ASKER

Idle_Mind and Mukeshsinqhq:

Actually neither one of your suggestions worked when I first tried them.  I then delete the button and placed a new button on the workspace and then both suggestions worked properly.  Don't understand why this happens, but I remember similar things happening a couple time before.  Had to replace the control for the code to work properly.

Thanks, and I will split since both suggestion were functional.

Happy Holidays.........
That can happen when you cut and paste a control from one place to another on the form.  When you do this it removes the "Handles xxx.yyy" portion of the code thus "un-wiring" it from the event.  To fix it WITHOUT placing a new one, click on the button then the "Lightning Bolt" Icon in the Properties Pane to get the events.  Next find the "Click" entry and press the DropDown to the right.  You should see an entry like "Button1_Click" that you can select to "re-wire" that sub to the event.
Avatar of GCCal

ASKER

Thanks for the info, Idle_Mind.  I didn't know that and it is a good tidbit to file away in this old mind.