Link to home
Start Free TrialLog in
Avatar of Joe Kaminski
Joe KaminskiFlag for United States of America

asked on

Setting Focus On A Control

I have a form with a tabcontrol.  Within the 3rd tabpage of the 1st tabcontrol is another tabcontrol.  On the 1st tabpage of the 2nd tabcontrol is a set of controls (datagridview, combobox, textbox, etc.).  When I click on the 3rd tabpage of the 1st tabcontrol the "_Enter" event for the 3rd tabpage of the 1st tabcontrol is fired and the datagridview is loaded.  Right after that I want to set the focus to the combobox that is also on that tabpage.  The combobox.focus does not seem to work.  Solution?

Private Sub tbpgTransactions_Enter(ByVal sender As Object, ByVal e As _ 
& System.EventArgs) Handles tbpgTransactions.Enter
        SqlDataAdapter1.SelectCommand.CommandText = "SELECT * FROM HM_Transactions"
        SqlDataAdapter1.Fill(HmsDataSet1.HM_Transactions)
        cbMntTrnAccountNumber.SelectedIndex = 27
        cbMntTrnAccountNumber.Focus()
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joe Kaminski

ASKER

Nice.  Thanks alot.