Visual Basic Concepts

Using Visual Basic's Standard Controls

See Also

You use controls to get user input and to display output. Some of the controls you can use in your applications include text boxes, command buttons, and list boxes. Other controls let you access other applications and process data as if the remote application was part of your code. Each control has its own set of properties, methods, and events. This chapter introduces you to the standard controls in Visual Basic.

For More Information   See "Using ActiveX Controls" in the Component Tools Guide for more information about the ActiveX controls available in the Professional and Enterprise versions of Visual Basic.

Topics

Introduction to Visual Basic Controls

Introduces you to the standard controls available in Visual Basic.

Validating Control Data By Restricting Focus

Explains how to use the Validate event with the CausesValidation property.

Working with Control Arrays

Describes control arrays and how they are used in Visual Basic.

Using the ADO Data Control

Use the ADO Data Control to create simple database applications without writing any code.

Using the Check Box Control

Use check box controls in groups to display multiple choices from which the user can select one or more.

Using the Combo Box Control

Use the combined features of a text box and a list box to allow the user to select an item either by typing text into the combo box, or by selecting it from the list.

Using the Command Button Control

Use the command button control to begin, interrupt, or end a process. When clicked, it invokes the command written into its Click event procedure.

Using the Common Dialog Control

Use the common dialog control to provide a standard set of dialog boxes for operations such as opening and saving files, setting print options, and selecting colors and fonts.

Using the Data Control

Use the intrinsic Data control to connect to desktop databases, such as Access.

Using the DataCombo and DataList Controls

Use the DataCombo and DataList controls with the ADO Data Control to display information from a database.

Using the DataGrid Control

Use the DataGrid control to create an application that allows the end user to read and write to most databases.

Using the File-System Controls (Directory List Box, Drive List Box, and File List Box)

Use the drive list box, the directory list box, and the file list box controls to allow users of your applications to explore the file system.

Using the Frame Control

Use the frame control to provide an identifiable grouping for other controls.

Using the Microsoft Hierarchical FlexGrid Control

Use the hierarchical flexgrid control for displaying data in a grid.

Using the Horizontal and Vertical Scroll Bar Controls

Use the horizontal and vertical scroll bar controls to provide scrolling to applications or controls when they are not provided automatically.

Using the Image Control

Use the image control to display graphics in the following formats: bitmap, icon, metafile, enhanced metafile, JPEG, or GIF files.

Using the Label Control

Use the label control to display text that cannot be edited by the user or to provide a description of what a certain control will do if clicked.

Using the Line Control

Use the line control to create simple line segments on a form, a frame, or in a picture box.

Using the List Box Control

Use the list box control to display a list of items from which the user can select one or more.

Using the OLE Container Control

Use the OLE container control to display and manipulate data from other Windows–based applications, such as Microsoft Excel and Microsoft Word for Windows.

Using the Option Button Control

Use the option button control to display options in option button groups from which the user can choose one.

Using the Picture Box Control

Use the picture box control to display graphics, to act as a container for other controls, and to display output from graphics methods or text using the Print method.

Using the RemoteData Control

Use the RemoteData Control to connect to large scale databases.

Using the Shape Control

Use the Shape control to draw predefined shapes on forms, frames, or picture boxes.

Using the Text Box Control

Use the text box control to display information entered by the user at run time, or assigned to the Text property of the control at design or run time.

Using the Timer Control

Use the timer control to execute timer events at specified time intervals.


Sample Applications

Alarm.vbp, Calc.vbp, Controls.vbp, Flex.vbp, Winseek.vbp

Many of the code examples in this chapter are taken from the Alarm.vbp, Calc.vbp, Controls.vbp, Flex.vbp, and Winseek.vbp sample applications which are listed in the Samples directory.