Forms
Forms are windows, and since you are familiar with Windows programs, you already understand the concept of a form. A simple Visual Basic form is shown below. It has a header area with a caption, a control menu, and minimize/maximize/close buttons. The large area of the form is the client area.
All Windows programs consist of one or more windows. Anything that appears inside a window is considered to be part of the application, including another window. In Visual Basic, the form is the main building block of the application, and is simply a window object. Controls are also window objects. They are distinguished from forms in that forms can exist as standalone objects, whereas controls can only exist within a form (with certain notable exceptions). Controls can also be placed inside other controls. In such a case, the controls have a parent-child relationship. In the same way, forms are the parents of the controls they contain.
There are three categories of information used to describe any object:
- Forms have properties that range from the caption displayed by the form to the physical size of the form.
- A form may recognise certain events, such as a simple user keypress or a mouse click.
- Forms also support various actions, known as methods, such as moving the form or loading it into memory.
Properties, events and methods apply to all objects in Visual Basic.Forms, like most objects, tend to have many properties, events and methods. The name of many of the properties is self-explanatory. The propeties window for the blank form shown above is illustrated below.