P. MAJ
P. MAJ

Reputation: 159

How to enable using TAB button in my Windows Form Application (Visual Studio)

So i have a few text boxes in my Form Application, and when I press Tab, instead of moving to the next field it first jumps to the button at the bottom of the form or goes to a random location.

Is there a code i need to use or can i change the properties in the design tab?

needless to say I am very new to Visual Studio, so any detailed help would be greatly appreciated.

Upvotes: 1

Views: 495

Answers (2)

mmathis
mmathis

Reputation: 1610

In the designer, each element has a property called TabIndex. This sets the ordering using tab to move between controls. Set the "first" control on your form to 0. The next control to get focus when pressing tab should get a TabIndex of 1, the next one a 2, etc. Some controls ignore the TabIndex where it doesn't make sense (e.g., a Label). You can also specifically exclude some controls with the TabStop property - set it to false to exclude that control.

Container controls (e.g., GroupBox, Panel) use a nested index, so the TabIndex resets within the container. The first element to get focus in the container will have index 0, and so on.

Visual Studio offers a nice tool to easily set the ordering. With the designer open, click View->Tab Ordering. You then click on each element in turn, and it sets the TabIndex of everything for you.

Upvotes: 3

P. MAJ
P. MAJ

Reputation: 159

sorted!

on the Properties box, on the properties tab, I can change the order of boxes and items by changing TabIndex!!!

sorted!

Upvotes: 0

Related Questions