Search code examples
c#winformspaneltabindextabstop

Why are some of my TabIndex values not being respected?


I've got a form with several controls on them (TextBox, CheckBox, ComboBox, NumericUpDown, DateTimePicker, and Button).

I have assigned them all TabIndex values, from left-to-right, top-to-bottom (1..25).

The controls are organized into Panels. The first control in the top panel has the focus first; tabbing from there goes through the first panel just fine, but then jumps over the second and third panels to the fourth panel (skipping TabIndex 11..15 on panels 2 and 3 and going to TabIndex 16 on panel 4).

All of the controls have TabStop set to True; all of the Panels have TabStop set to False.

Why are my controls on panels 2 and 3 being bypassed?

UPDATE

TnTinMn inspired me to check it out; I had never noticed that option before. Here is what my form looks like with that view:

enter image description here


Solution

  • This seems somewhat macabre, wacky even, but I had to give the Panels TabIndex values in incrementing values for it to work. That is to say, after I gave the first Panel a TabIndex of 0, the second panel 1, etc., it worked - even though they are all set to TabStop = false.

    Seems bizarre to me that an unstopped location is considered at all in the tabbing scheme of things.