What, exactly, does the phrase “encapsulates the Windows PI” mean? Encapsulation is a key concept for any object-oriented programming language. It refers to the capability of an object to hide its internal workings from other objects. In turn, the object allows itself to be manipulated by the programmer and other objects through the use of three key object features: properties, methods, and events.
Let’s consider two kinds of objects that you have seen in the Visual Basic startup screen: forms and controls. The image below shows a Window that contains a form named Form1. This form acts as a container for controls. You could think of Form1 as a blank piece of paper that you must fill in. You use this blank form to design the user interface for a Visual Basic application. When you begin the design of a Visual Basic program, you start with a blank form and, with a set of tools, begin to design the user interface.
The tools you use to construct the interface are called controls, which are attached to forms. Examples of controls are shown on the toolbox and include a text box (a box the user types text into), a command button (an on-screen button that the user can click), and a label (an area on the form to place a text heading). If the toolbox is not visible, select View, Toolbox on the menu bar, or click the toolbox button on the toolbar to display it.
Because forms and controls are objects, they can be manipulated by properties, methods, and events. Let’s consider each of these object features in turn.