What am I missing (TabStop)

  • Thread starter Thread starter John Baro
  • Start date Start date
J

John Baro

Where is my TabStop property.
I want to prevent tabbing to a label.
In the MSDN it shows

Label.TabStop Property
This member supports the .NET Framework infrastructure and is not intended
to be used directly from your code.

And sure enough it is not accessible.

HUH?

BJ
 
In WinForms, labels can't be a tabstop, so you don't need to set the
property.

However, you can use the TabIndex property of a label to provide a shortcut
key to another control that does act as a TabStop however.

For example:

TextBox1.TabStop = true;
TextBox1.TabIndex = 3;

Label1.TabIndex = 2;
Label1.Text = "&Some Value";

In your WinForm application, hitting Control-S should put focus right into
TextBox1. This assumes that you don't have another control with a TabIndex
of 3 also set and that you don't have other labels or menus with the
Control-S shortcut setup also.
 
Hi Michael

The problem is that I have a group box that has a label.
Normally I set the labels tabindex to be 900+ so it doesnt matter but in
this case it does because it is not doing anything becuase it is going to
the label and then presumably on to the next control in the group box which
is ???

**********
Solved.
**********

I set the tabindex to make the label before the textbox.
Problem is that this does not always work but I can make it work.
I set the focus to the next control in the keydown event of textboxes using
getnextcontrol and canfocus.
If the next control is a label this does not work because a label cannot
receive the focus.
Thats all right. If I always set labels in group boxes (or full stop) to be
the first items then it should be ok.
Hope I explained myself all right.
Probably not.

Thanks
JB :)
 
Back
Top