.Net WinForms TabControl Steals Focus on form activation

I wonder if there is anyone who can help me?

The problem I am facing is the shape of the TabPage window involving a focus on reactivating the form. The form has a TabControl with four or five tabs. Each tab has many different controls.

The scenario is as follows: The user enters several controls in the first TabPage tab, and a new form is created and displayed (say, from one of the Leave TextBox events), which removes focus from the first form, since it focuses itself. Users select a value in a new form and close it. - Then I expected that the original form would know where the user put the tab and set focus on this control.

However, it seems that when the form is reactivated, it sets the focus, and not back to where the user went, or even the first control in the tab-order of the active TabPage. Instead, it focuses on the most active tab.

Is there anything around this?

Thanks and kind, Dwayne.

+4
source share
1 answer

I created the variables (in the tab-control class to save them in the area) to save the current page and the last page visited, also create a variable to store the control with focus, use a pointer, a link, whatever.

When you return, use this variable to restore focus for this control.

NTN

+1
source

All Articles