Format Menu in VB .NET

In this article, I will explain you about Format Menu in Visual Basic .NET.
  • 2914

In this article, I will explain you about Format Menu in Visual Basic .NET.

In Visual Basic .NET when we want to align, layer or lock the controls on a form then we use theFormat Menu. To arrange controls on the form there are many options which are provided by the Format Menu.

img1.gif
 

When we use Format Menu to arrange controls on the form, we have to select the controls in such a way that the selected control is the primary control we use primary control as the alignment reference for other controls. The table below shows you available options in Format Menu:

Options

Use

Align

Aligns all controls with respect to the primary control

Make Same Size

Resizes multiple controls on a form

Horizontal Spacing

Increases horizontal spacing between controls

Vertical Spacing

Increases vertical spacing between controls

Center in Form

Centers the controls on form

Order

Layers controls on form

Lock Controls

Locks all controls on form

Aligning multiple controls on a Form

In Visual Basic .NET we can align multiple controls on a form. Let's see an example. Open a new project and drag some controls on the Form1 from the toolbox. Select the controls you want to align and make sure that the last control you selected is the primary control to which all other controls align. As you see in the image that the Button control is with dark handles it is the primary control.

img2.gif

Now after selecting the option Lefts under Align from the Format Menu you can see all the controls are left-aligned. As shown in the image below:

img3.gif
 

Make Same Size

To make controls of same size we can use the Make Same Size option under Format Menu. It provides four options WidthHeightBoth and Size to Grid and by these options we can make all the controls same in size. As shown in the image below:

img4.gif
 

Locking Controls

When you want that all the controls on a form cannot be moved accidentally then we can useLock Controls option to lock all selected controls. A shown in the image below:

img5.gif

Summary

I hope this article help you to understand about Format Menu in Visual Basic .NET.

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.