Results 1 to 4 of 4

Thread: Go to Tab Page

  1. #1
    daPoet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jul 2008
    Posts
    23
    Reputation
    79

    Go to Tab Page

    I'd like to display the content of a particular tab page, when I click on a button

    Current my code is
    Code:
    Me.TabPage1.Show()
    That works partially, in that it does display the content of the page, but the correct tab is not selected.

    E.g.

    If i were on Tab Page 2 and I used this code to show Tab Page 1,

    I would see the contents of Tab Page 1 but Tab Page 2 would still be selected.

    Please assist.

  2. #2
    daPoet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jul 2008
    Posts
    23
    Reputation
    79

    Wink Solved

    I saw a thread with this heading using todays date to select a tab
    That was exactly what I needed.

    Sorry for the disturbance ;-)

  3. #3
    InertiaM is offline VB.NET Forum Idol
    .NET Framework
    .NET 2.0
    Join Date
    Nov 2007
    Location
    Kent, UK
    Posts
    663
    Reputation
    249
    You change the SelectedIndex property for the TabControl e.g.

    Code:
          TabControl1.SelectedIndex = 1
    You can also 'lock' the user onto a specific TabPage by using the Deselecting event e.g.

    Code:
        Private Sub TabControl1_Deselecting(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles TabControl1.Deselecting
            Select Case TabControl1.SelectedIndex
                Case 0
                    If btnProceed0.Enabled = False Then e.Cancel = True
                Case 1
                    If btnProceed1.Enabled = False Then e.Cancel = True
                Case 2
                    If btnProceed2.Enabled = False Then e.Cancel = True
            End Select
        End Sub
    Hope that helps

  4. #4
    daPoet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jul 2008
    Posts
    23
    Reputation
    79
    Yeah it did.

    And right on spot with a little searching of the forum too.

    Thanks a million

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
  •  
Harvest time tracking