Previously I had one form and TabOrder was easy. Now we have moved part of the controls in that form to a separate .NET custom control and we are hosting that custom control inside the previous form
So now some of the buttons are still are the main form and the rest of the form is inside that custom control and it has cause a Change in TabOrder of the controls.
How can I fix this so the TabOrder will behave the same as it used to be?
Thanks.
Let me expand on my comment as I just imagined how tab order might be confusing when a control container is involved.
Let’s say we have six buttons (A, B, C, D, E, and F):
(I know it’s a lousy diagram, but I can’t do a nice one quick and dirty)
A, B, E, and F are directly on your Form’s surface.
C and D are contained in a user control named Z.
If you want the tab order to follow the alphabetic sequence, you would set
TabIndexvalues like this:Tabbing for a control container is relative to the controls inside. The algorithm is fairly simple: When TAB is pressed, the Framework looks for the next control in the sequence(*). So A tabs to B and B tabs to Z. Z is a container, so focus goes to the ‘first’ child C. C tabs to D. D tabs out of the container resuming where we left off with E. E tabs to F. F tabs out of its container which is the top-level container so we start all over again, F tabs to A.
(*) There can be gaps in the sequence and if there are two items with the same TabIndex, they are further evaluated by their Z-Order index.