Tabcontrol selecting one of the pages


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Tabcontrol selecting one of the pages

  1. #1
    k Guest

    Tabcontrol selecting one of the pages


    I have a tab control with 4 pages on it, on a form, I have a button on the
    same form and I am trying to make that button select a different tab. Any
    Ideas...

    Thanks!

  2. #2
    Kevin Guest

    Re: Tabcontrol selecting one of the pages


    Here's some code from one of my programs, hope it helps


    Dim bttn As Button, cntl As Control
    bttn = sender
    For Each cntl In Me.Panel2.Controls
    If (TypeOf (cntl) Is Button) And (cntl.Tag = "panel") Then
    CType(cntl, Button).FlatStyle = FlatStyle.Standard
    End If
    Next
    bttn.FlatStyle = FlatStyle.Flat
    Select Case bttn.Name
    Case bttnCustomers.Name
    TabControl1.SelectedTab = TabPage1
    Case bttnAddresses.Name
    TabControl1.SelectedTab = TabPage2
    Case bttnRentalTickets.Name
    TabControl1.SelectedTab = TabPage3
    Case bttnOnRent.Name
    TabControl1.SelectedTab = TabPage4
    Case bttnInvoices.Name
    TabControl1.SelectedTab = TabPage5
    End Select

  3. #3
    K Guest

    Re: Tabcontrol selecting one of the pages


    Kevin,

    This is what I was looking for!!!
    Thanks So much!!
    K



    "Kevin" <vb.@127.0.0.1> wrote:
    >
    >Here's some code from one of my programs, hope it helps
    >
    >
    > Dim bttn As Button, cntl As Control
    > bttn = sender
    > For Each cntl In Me.Panel2.Controls
    > If (TypeOf (cntl) Is Button) And (cntl.Tag = "panel") Then
    > CType(cntl, Button).FlatStyle = FlatStyle.Standard
    > End If
    > Next
    > bttn.FlatStyle = FlatStyle.Flat
    > Select Case bttn.Name
    > Case bttnCustomers.Name
    > TabControl1.SelectedTab = TabPage1
    > Case bttnAddresses.Name
    > TabControl1.SelectedTab = TabPage2
    > Case bttnRentalTickets.Name
    > TabControl1.SelectedTab = TabPage3
    > Case bttnOnRent.Name
    > TabControl1.SelectedTab = TabPage4
    > Case bttnInvoices.Name
    > TabControl1.SelectedTab = TabPage5
    > End Select



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center