Results 1 to 3 of 3

Thread: Tab Control Question..........

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Tab Control Question..........

    I need to code a command button to switch to a different tab on my tab control. A user is filling out something ont he first tab and then needs to be able to just hit the command button to go to the next tab without having to manually click on the tabs a at the top to switch between then. How do I activate a differnent tab?

  2. #2
    Lively Member Neoharuo's Avatar
    Join Date
    Aug 2005
    Posts
    100

    Re: Tab Control Question..........

    Your button code will look like this

    VB Code:
    1. TabControl1.SelectedTab = TabControl1.TabPages(1)

    This will take you from what ever your current tab is to the second tab page. But thats the general code. You can play around with it and tweak it how ever you need.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Tab Control Question..........

    I'm not sure why clicking a button is easier than clicking a tab, but you can set either the SelectedIndex or SelectedTab property of the TabControl. To go to the next tab try:
    VB Code:
    1. myTabControl.SelectedIndex += 1
    Make sure you don't call this without checking that you aren't on the last tab already or you'll get an exception.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width