I seem to have an issue with keyboard control and TabStops in my VB.NET application.
I already searched here and on the web and found a few related topics (not 1000% the same issue) and some of the solutions I could find on the web did not help in my case.
I am not sure if my problem is mainly related to the use of group boxes and could be solved. As a rough depiction of the controls setup see here a schematic overview:
GroupBox1____ GroupBox2_____ GroupBox3
Control1_______ Control4________ Control7
Control2_______ Control5________ Control8
Control3_______ Control6________ Control9
I have set the TabIndex for the group boxes and controls in order so that Tab can cycle through Control1 to control9. When the Form loads I give the focus to one of the controls by code to have an initial focus on one control. That works without any problem. Also cycling backward with Shift-Tab works just fine.
Now the problem is when a user accidentally goes past the last control, e.g. Control9 has focus and he presses TAB or Control1 has focus and he presses Shift-TAB the control loses focus but it does not jump to the next lowest or highest TabIndex control with TabStop=True.
Basically, it enters a state where no control has a focus, and pressing TAB or Shift-TAB does nothing. (I would expect it to go around in a round-robin fashion)
The only way is then to click on any control with the mouse to regain focus and regain keyboard control. Not sure if this is a bug or a feature.
I understand that VB.NET handles each groupbox as an individual set of controls, but not sure if this might be related to my problem.
Also there are some other controls on the form which have higher TabIndex numbers, but TabStop set to False (most of them are no input controls anyway, e.g. some pictureboxes or labels). That should normally not interfere in my understanding.
Is it relevant what type of control they are? (e.g. Control9 is a checkbox and COntrol1 is a radio button control)
I already tried as a workaround e.g. to catch a keypress event or lost focus event to force a re-focus on the next control in sequence by code, but for some reason, I am not able to do it programmatically as some of the tried events do not seem to fire when using TAB or Shift-Tab.
Is someone familiar with this problem and has a suggestion on how I could move e.g. from Control9 to Control1 when hitting TAB? (or from Control1 to Control9 when hitting Shift-TAB)?