Results 1 to 2 of 2

Thread: VB.NET TabControl getting focus

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    15

    Question VB.NET TabControl getting focus

    Hi there!

    Help me, please, in a litle question.

    I have developping a litle aplication that have a listbox named Mes and a TabControl named Tabelas with two Tabs.
    In Mes I have the months of the year.
    In Tabelas I have one Tab named Norm (to display data about Normal Work) and one named Extra (to display data about Extraordinary Work).
    All I want is, if the second tab (Extra) is selected, that the one tab (Norm) will be selected when Mes index became changed by the user.

    For that, I use this code

    Code:
    Private Sub Mes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mes.SelectedIndexChanged
    
    If Tabelas.SelectedIndex = 1 Then Tabelas.SelectedIndex = 0
    
    End Sub
    The problem is, in case of using the cursor keypad, when the user changes the index of Mes, the focus goes to the Norm tab contents and becames impossible to continue listing the values in Mes.
    The only solution I have is adding the line
    Code:
    Mes.Select()
    in Mes_SelectedIndexChanged sub to make the focus return to Mes listbox after the execution of the code.

    My question is:
    Are there an alternative way to do this?
    I mean, another way to select the first Tab in TabControl Tabelas without giving it the focus?

    Thanks in advance and sorry my english (I'm from Portugal).

    Best regards.
    Tedioboy
    Last edited by Tedioboy; Jan 2nd, 2012 at 02:39 PM.

  2. #2
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: VB.NET TabControl getting focus

    probably not

    you have to select the tab to select it so by selecting it gets focus

    odly what you might expect

    here to talk

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