views:

548

answers:

2

I have a pretty complex UI with hundreds of control/label on it. I want to set tabstop value as false for each label as below

//in MyForm.designer.cs

Label myLabel;

private void InitializeComponent()

{

this.myLabel = new Label();

this.myLabel.TabIndex = 1;

...

}

// in MyForm.cs

this.myLabel.TabStop = false;

But it is not working. Is there any way to set the tabstop value so that tab is not stopped at myLabel??

A: 

Try setting the tabindex to -1, that usually causes tabs to be skipped in most implementations that I have used.

Kelsey
Most implementations of what?
Pavel Minaev
Most implementations of controls with a tabindex feature. I thought that was obvious.
Kelsey
A: 

If you are using standard Label control, it should not get focus. Behavior of Label is to just forward focus to first control that can get it (e.g. TextBox). However, do notice that if you have control that can have input focus (e.g. TextBox), once that control gets focus, focus will stay with it regardless of TabStop property.

Josip Medved