Setting Form and Control Properties
Properties are named attributes of a form They define an object's characteristics, such as size, color, and screen location, and aspects of the object's behavior, such as whether it is enabled or not. You can set properties in the Properties window at design time , and in code at run time . or control .
To set form or control properties in the Properties Window at design time
1. Click a blank part of a form to select the form; or click a control to select the control.
2. From the Window menu, choose Properties (F4), or use the toolbar shortcut:
3. From the Properties window, select the property you want either by clicking the property name in the Property list or by pressing Ctrl+Shift+ the first letter of the property name you want to select. If several properties begin with the same letter, continue pressing Ctrl+Shift+ the first letter key until the property you want is selected.
Visual Basic displays the current setting for the property in the Settings box .
4. In the Settings box, enter the setting you want.
For a property that requires entering text or a number, type the information.
For a property that has enumerated or Boolean values, click the down arrow to the right of the Settings box and select the option you want from the combo box or double-click the property name to cycle through the list of available choices.
For a number of properties, the down arrow changes into a button with three dots . Click this button to display a dialog box in which you select the settings for the property.
5. Click the Enter button to accept the setting or click the Cancel button to cancel it.
6. Repeat steps 3-5 for each property you want to set for the selected form or control.
Note To set a property that is shared by more than one control on a form, select the controls that share the property you want to change. Change the property in the Properties window to affect all selected controls.
To set form or control properties at run time
Place a reference to the property (object.property) on the left side of an assignment statement . For example:
Text1.Text = "Your Name"
Learning Visual Basic:
Creating an Application
Chapter 2, "Your First Visual Basic Application"