CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2009
    Posts
    2

    Pressing a button and send you to the correct tabpage.

    Greetings! I have created seperate tabs, each tab solves a mathematic problem, on windows application form. My problem is that I want to create a menu, where each user of my program can choose with which tab want to work with. So I need a command which ll send my program to the correct tab.

    For example I want to create 2 buttons 1 will send me to the first tab and the other button to the second tab:

    Button1: TabPage1
    Button2: TabPage2

    I have 1 idea how to do it.

    By adding a new form before my current form.

    But still I dont know the command that can do what I need, send my program to the correct tab depending on what I have choose on my menu.

    Sorry about my english. Thanks in advance.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Pressing a button and send you to the correct tabpage.

    Create a member variable for the tab control.

    In each of the button handlers, call SetCurPos for the tab control.

    For example, in the first button handler:
    Code:
    m_TabCtrl.SetCurPos( 0 );  // zero based index sets the first tab
    ..the second button handler:
    Code:
    m_TabCtrl.SetCurPos( 1 );  // zero based index sets the first tab

Tags for this Thread

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

Featured