Posted by: Cirilo Meggiolaro | 02/19/2009

Tip of the day #128 – Setting tab order in a few clicks

A useful tip for those that haven’t developed Windows forms applications or that don’t have a lot of experience on it. What if you had to change the tab order for 2 controls on a form? Easy? Fast? What about a form with 50 controls?

Sometime ago it used to take a lot of time to select each control and change the TabIndex property on the property window. The Visual Studio has a feature (that is not new) where you can change the tab order in a few clicks.

How to…

  • Open your Windows Form application;
  • Open the form you want to set the tab order;
  • Go to View menu and select Tab Order;
Picture 1 - Tab Order option under View menu.

Picture 1 - Tab Order option under View menu.

  • Each control on your form displays a number on the top left corner. If you have a container such as a GroupBox control, the container will have the tab index number and its child controls will display the container index plus an internal sequential index separated by a dot;
Picture 2 - The form with the tab indexes displayed.

Picture 2 - The form with the tab indexes displayed.

  • To change the tab order for all controls you just need to click on all controls, one at a time. If you click on a container child control though, you are going to set the tab index only inside the container. You still need to set the container tab index.
Picture 3 - The form with the tab indexes reorganized.

Picture 3 - The form with the tab indexes reorganized.

Enjoy it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: