VB MultiPage Focus problem

  • 16 years ago


    I have a MultiPage control on my form which has 4 pages (tabs).

    Each page has controls on it like textboxes, comboxes etc.

    When the current focus is inside a textbox/combobox on a tab,  I have to click the desired tab twice to select it.


    Current focus is in a textbox on tab 3. I want to select tab 4.
    The first click on the tab 4 gets the focus on Multipage control only.
    Now I have to click again on tab 4, to view its contents.

    What is the solution, so that i can get this done in a singe click?.


  • 16 years ago
    Hello Everyone

    Can anybody help me here?

    I am stuck, and the users are really getting annoyed by having to click the tab twice everytime.

  • 16 years ago

    Ok. Let me re-word my problem.

    I have a MultiPage control on my form which has 3 pages
    (This is different from the Tab control, but looks exactly similar)

    Each "page" (tab) has a frame on it.

    So page 1 has frame 1 on it,
    page 2 has frame 2 on it
    page 3 has frame 3 on it.

    Frames are used to hold all the related controls (textboxes,label,combos etc) together.

    A click on the pages (or tabs) on top of this Multipage control generates the following event:

    Private Sub mPage_change()

    If mPage.Value = 0 Then
    Frame1.Visible = True
    End if
    If mPage.Value = 1 Then
    Frame2.Visible = True
    End if
    If mPage.Value = 2 Then
    Frame3.Visible = True
    End if

    End Sub

    Now here is the problem:

    If user selects page 1. The corresponding frame becomes visible and the user starts typing in a textbox on that frame.

    The cursor/focus is in the textbox. Now the user decides to change the page (tab).

    The first click by user just selects (gets focus on) the "MultiPage Control".

    The user has to click once more to actually initiate the mPage_change() event.

    The user gets annoyed when he clicks the tabs on the top for the first time and nothing happens.

    Is there any way we can get the "focus" and "change" event both done in single user click?


  • 16 years ago

    It seems like you are using the TabStrip control.  I don't know why you are getting the problem but one solution would be to change to the Tabbed Dialogue contol.
    If this is not possible then I would look at any code in the lost focus event of the control, the frame the control is on and the got focus event on the tabstrip

  • 16 years ago

    I am using MultiPage control.

    I also tried using:  Private Sub mPage_Click(Index As Long) event.

    But it still needs 2 clicks  

    I am on page 2.
    Page 2 has a frame on it. My focus is inside a textbox on that frame.

    Now I click on the Page(tab) 4.
    First click selects the mPage control only.  I checked this in debug mode. The first click does not generate any event. The second click generates mPage_Click event.

    Need Help.

    (note: The MultiPage control is on a form, and has 4 pages.)

  • 16 years ago
    I can't recall a standard VB control called the multipage control so I can't help you apart from general debugging assistance.  
    You should also be aware that steping through code wil not always execute the control events in the same order as they happen in real time. Sometimes you are better off putting a stack of debug.prints throughout your code and following what happens that way.
    If the Multipage control is a third party control I'd email their support area and ask them about this problem.  If  is is an MS control try searching their knowledgebase for the name of the control.

    Best of luck

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic