Partager via


Visual Basic Concepts

Forms, Controls, and Menus

The first step to creating an application with Visual Basic is to create the interface, the visual part of the application with which the user will interact. Forms and controls are the basic building blocks used to create the interface; they are the objects that you will work with to build your application.

Forms are objects that expose properties which define their appearance, methods which define their behavior, and events which define their interaction with the user. By setting the properties of the form and writing Visual Basic code to respond to its events, you customize the object to meet the requirements of your application.

Controls are objects that are contained within form objects. Each type of control has its own set of properties, methods and events that make it suitable for a particular purpose. Some of the controls you can use in your applications are best suited for entering or displaying text. Other controls let you access other applications and process data as if the remote application was part of your code.

This chapter introduces the basic concepts of working with forms and controls and their associated properties, methods, and events. Many of the standard controls are discussed, as well as form-specific items such as menus and dialog boxes.

Topics

Understanding Properties, Methods and Events

An introduction to objects and their associated properties, methods, and events.

Designing a Form

The basics of working with a form's properties, methods, and events.

Clicking Buttons to Perform Actions

An introduction to the command button control.

Controls for Displaying and Entering Text

An introduction to the label and text box controls.

Controls That Present Choices to Users

An introduction to the check box, option button, list box, combo box, and scroll bar controls.

Controls That Display Pictures and Graphics

An introduction to the picture box, image, shape, and line controls.

Additional Controls

An introduction to the other standard Visual Basic controls.

Understanding Focus

A brief discussion of focus as it applies to controls.

Setting the Tab Order

An introduction to the concepts of tab order within a form.

Menu Basics

An introduction to menu controls and the menu editor.

Prompting the User with Dialog Boxes

An introduction to dialog boxes.

Sample application

Controls.vbp

The code examples in this chapter are taken from the Controls.vbp sample application which is listed in the directory.