what could be the possible reasons for TabIndex not working properly

I'm mentioning this because I haven't seen it in any of the winforms tab order threads that I have found on stackoverflow.

If you have multiple panels, you change your panel tab order by clicking on the Panel, going to properties, and then you change the TabIndex to whatever you want. This will allow you to navigate from panel to panel in the order that you want. Then within each panel, follow the recommended steps listed above using view > tab order and click on each cell in the order that you want to set.


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.


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.

Tags:

C#

Winforms