so I have started from 0 and defining tabindex for the controls on my form but at run time it is all messed up. the form is a little complex tho. it has horizontal and vertical splitters and panels, group boxes and some older VB 6.0 activeX controls which is a Tree control inside them. even if i do it programmatically and read previewkeydown eventg and say if it is TAB then control2.Focus() it is still working wrong. so frustrating. any thoughts? ..there are also labels on the form which do not need tab so I have defined 0 for their index.
The reason is that the controls are in different Containers. Suppose you've got panel1.TabIndex = 0 and panel2.TabIndex = 1, then in panel2, textBox1.TabIndex = 0, in panel1, textBox2.TabIndex = 1. At runtime, textBox1 comes before textBox2 because its panel comes first!
As kerry said, use view->tab order to see the complete hierarchy of tab orders.
How are you setting it? If you are in visual studio with the form in design view select view -> tab order and then click on each item in the order you want them.
Usually works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With