DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links