I have WinForm with 3 group boxes, one with combo boxes and two with radio buttons. I set all of them and their child controls to "TabStop = false", but when I switch from TAB, the currently selected switch in each of the last two group blocks is focused.
If there is no way to change this behavior, what would be a good event to catch and shift focus? I can not find the OnFocus event.
The solution is to set up one method (code below) to handle the "Enter" event of each switch in the form (if necessary).
In fact, I only did this for the switches in the first group field, and it worked, and the switches of the second group field do not focus, although their "Enter" events are not processed. This is not the behavior you expected.
private void radiobuttonXGroup1_Enter(object sender, EventArgs e)
{
SomeOtherControl.Focus();
}
In the * .Designer.cs file, you edit each Enter event (for each switch) to point to one event handler (the above method).
this.radiobutton1Group1.Enter += new System.EventHandler(this.radiobuttonXGroup1_Enter);
this.radiobutton2Group1.Enter += new System.EventHandler(this.radiobuttonXGroup1_Enter);
this.radiobutton3Group1.Enter += new System.EventHandler(this.radiobuttonXGroup1_Enter);
source
share