PROPERTIES

A property is some value associated with a control. Often, a property corresponds in an obvious way to the control’s appearance or behavior. For example, the Text property represents the text that the control displays, BackColor represents the control’s background color, Top and Left represent the control’s position, and so forth.

Many properties, including Text, BackColor, Top, and Left, apply to many kinds of controls. Other properties work only with certain specific types of controls. For example, the ToolStrip control has an ImageList property that indicates the ImageList control containing the images the ToolStrip should display. Only a few controls such as Button and TabControl have an ImageList property.

The following sections explain how you can manipulate a control’s properties interactively at design time or using code at run time.

Properties at Design Time

To modify a control’s properties at design time, open its form in the Windows Forms Designer and click the control. The Properties window lets you view and edit the control’s properties.

You can set many properties by clicking a property’s value in the Properties window and then typing the new value. This works with simple string and numeric values such as the controls’ Name and Text properties, and it works with some other properties where typing a value makes some sense.

For example, the HScrollBar control (horizontal scrollbar) has Minimum, Maximum, and Value properties that determine the control’s minimum, ...

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.