Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'this will select a tab page without changing the current focus
- 'https://stackoverflow.com/questions/4044711/select-tab-page-in-tabcontrol-without-stealing-focus
- Private Sub SelectTabWithoutFocus(tabPg As TabPage)
- 'cache the current focused control (ActiveControl), select the tab which makes it the current tab (and also sets the focus to the tab),
- 'and finally re-set focus to the original control.
- Dim prevFocusedControl = Me.ActiveControl
- If Me.ActiveControl IsNot Nothing Then
- tbcMain.SelectedTab = tabPg
- If prevFocusedControl.CanFocus Then prevFocusedControl.Focus()
- End If
- End Sub
Add Comment
Please, Sign In to add comment