Controls

See Also320KG4L                 Controls ListR8T0KA

Description

A control is an object that you draw on a form5272EF to enable or enhance user interaction with an application141RJVK.  You add menu controls to a form using the Menu Design windowV4GKGG; all other controls appear in the Toolbox414LEZP and are placed on a form by double-clicking them or by clicking and then dragging them onto a form.

Remarks

Controls accept user input or display output.  Controls have properties that define aspects of their appearance, such as position, size, and color, and aspects of their behavior, such as how they respond to user input.

Controls can respond to events1L2S0SZ initiated by the user or triggered by the system.  For example, you could write code in a command button's Click event procedure that would load a file or perform a calculation and then display the result.

In addition to properties and events, you can use methods1XB6QBF to manipulate controls from code.  For example, you can use the Move103G76J method with some controls to change their location and size.

Each control has its own set of properties, events and methods.

Note that the Control keyword is an object type and you can use it to declare a variable of type Control before setting it to a specific control type.  You can also declare a procedure parameter to have type Control.

GraphicalSZH8PW controls include the image, label, line, and shape controls.  A graphical control uses fewer system resources and has different drawing and display characteristics than other controls.


Controls List

 

Control                     Description

Check box9P3BU5                 Gives the user a TrueGUB0I0/False3G3PGD or Yes/No option.

Combo box1YZXFF6                Enables the user to make a selection by typing text into a text box or by selecting an item from a list.

Command buttonXJSPC0        Chosen by the user to begin or end a process.

Common dialog 1H1HYJI         Provides a standard set of dialog boxes for operations such as opening, saving, and printing files or selecting colors and fonts.

Data control2E1FEX3               Enables the developer to create applications that view and manipulate databases.

Directory list boxO9U5A0       Enables the user to select directories and paths at run time.

Drive list box5WJO0PW             Enables the user to select valid disk drives at run time.

File list box1M6S8UX                Enables the user to select files at run time.

Frame1KX6ZP8                       Provides a functional grouping and container for other controls.

Grid2VGT0PT                           Provides a matrix of spreadsheet-type cells whose contents can be manipulated in code.  Grid is a custom control2SOD6E supplied with Visual Basic.

Horizontal scroll bar1JSJOS7   Allows navigation through lists or forms; also can indicate position in a range.

Image9A4FCA                        Displays a bitmap1MF6V4R, icon529QBG, or metafile13MILUI as a graphic.

Label3MNIZ8D                         Displays text the user can't change.

LineTW530P                           Displays itself as a horizontal, vertical, or diagonal line.

List boxG11UCK                     Displays a list from which the user can select one or more items.

MenuBKDT1F                         Displays a menu on a form.

OLE control2HQDVVU               Allows a programmer to create applications that can display and allow editing of data from many different applicationsfor example, objects created by draw, graphics, and spreadsheet applications.  Data from another application can be edited within the application in which it was created

Option buttonJYBO08             As part of a group of option buttons, displays multiple choices from which the user can select only one.

Picture box31MYIWX                Displays graphics that are drawn with Circle38E9WK, LineGU01B0, and Print9V51E5 methods, or that are loaded from a bitmap, icon, or metafile.  Can also act as a container for other controls.

Shape9JZFLA                        Displays itself as a variety of shapes including boxes, circles, and so on.

Text boxYPYZDG                    Displays text the user can edit.

Timer3MVR08J                        Enables you to run code at a specified time interval.

Vertical scroll bar1JSJOS7       Allows navigation through lists or forms; also can indicate position in a range.


See Also

Help:

ActiveControl PropertyJCXG6P

ActiveForm PropertyGCUI9X

Controls CollectionB2IKWH

Creating a Menu Bar1DSHCUG

Drawing a Control2JRMWVS

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"