Setting Form and Control Properties

See Also1376TNQ

Properties are named attributes of a form5272EF or controlXX9KJT.  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 windowO00AW8 at design timeCFSL0V, and in code at run timeCYRM35.

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 boxAV4YN4.

   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 BooleanDOKXHY 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 dots51NRBM.  Click this button to display a dialog box in which you select the settings for the property.

   5. Click the Enter button1MFBOJ1 to accept the setting or click the Cancel button1H62MC 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 ( on the left side of an assignment statement2FQ9WRL.  For example:

Text1.Text = "Your Name"

See Also


Properties List9K1S0SM


Learning Visual Basic:

Creating an Application


Programmer's Guide:

Chapter 2, "Your First Visual Basic Application"