Given this brief introduction to Visual Basic, it is time for you to become more familiar with the Visual Basic programming environment. Still, you are not expected to write a Visual Basic program at this time; right now, you’ll start Visual Basic and become a bit more familiar with the way in which the environment can be configured.
A Quick Tour of the Visual Basic Design Environment.
The Visual Basic design environment is almost infinitely configurable. This makes it difficult to describe a standard Visual Basic user interface. It depends upon the way the design environment was last configured.
There are two overall design environment choices: MDI or SDI. The abbreviation MDI stands for multiple-document interface, and it is the default Visual Basic setting. It features an overall container window and movable and dockable windows inside the container. It is the environment shown under the topic Low-Visual and High-Visual Languages. The abbreviation SDI stands for single-document interface. It features free-floating windows on the Windows desktop, which is the environment that would be most familiar to you if you have worked with previous versions of Visual Basic.
Whether the environment is MDI or SDI, the Visual Basic start-up environment frequently displays the windows and utilities in the Table 1.1 below. These windows and utilities are described in detail later.
|Project Explorer window||This window is frequently positioned on the right of the Visual Basic container. It lists the modules that make up a Visual Basic project|
|Form Module window||This Window displays a form if a form is selected for viewing in the Project Explorer. This form is selected for viewing in the Project Explorer. This form is the "canvas" upon which controls are placed.|
|Properties window||This window displays the properties for whatever object has focus – whether a module or control.|
|Toolbox window||This window displays controls for placing on forms.|
The MDI Design Environment: Using Dockable Windows
The multiple-document interface for Visual Basic 5.0 is new. It allows you to configure the Visual Basic design environment in many ways, but it can be confusing. In order to use it effectively, you must have a large screen set to a fairly high resolution; otherwise, you will quickly suffer from screen clutter. It also requires that you know how to work with dockable windows, an interface feature designed for those who prefer to use a mouse, rather than the keyboard, as a principal input device.
If you have not used dockable windows inside a container before, you might find them frustrating at first. Dockable windows allow you to take any window inside a container and dock it on the perimeter of the container. As you move a window inside a container by keeping your mouse button depressed on the window title bar while moving it, an outline of the window is displayed. The width of this band gives you a visual cue as to what you can do with the window. A thick band outline indicates it will become free-floating if released by the mouse button. Figure 1.8 shows the toolbox docked to the right-hand side of a form.
|Figure 1.8 The toolbox will be docked at the side of the Visual Basic form when the Dockable command (right-mouse button) is selected.|
Given the capability to dock any window at any position in the Visual Basic MDI container, it is possible to customize the environment to your liking. Many developers prefer to dock the toolbox at the bottom of the container in order to make room for form design.
To view a window or toolbar that is not displayed, choose View from the Visual Basic menu to see a list of windows and design-time utilities.
The capability to dock windows within the MDI environment can be controlled through the Docking tab of the Options dialog box (choose Tools, Options). If the docking option for a window is not selected (see Figure 1.9), it will remain free floating.
|Figure 1.9 . The Docking tab of the Options dialog box presents many possibilities for docking the Visual Basic windows and design tools, such as the Color palace.
The SDI Design Environment: Using Free-Floating Windows
The single-document interface, the one preferred by the authors, essentially makes all windows free-floating outside of any container. This increases the amount of screen “real estate” available, which is important in the rich (and often times cluttered) design environment of Visual Basic. The SDI design environment is probably also more familiar to you from working other Windows applications, including earlier versions of Visual Basic.
To move to an SDI environment, select the Advanced tab in the Options dialog box (by choosing Tools, Options), as shown in the image below.
|Figure 1.10 The SDI selection in the Options dialog box creates a design environment in which windows remain separate and are no longer docked.|
Once the SDI environment is selected, a dialog box will appear, informing you that your selection will take effect the next time Visual Basic is launched. To view the SDI environment, exit Visual Basic (by choosing File, Exit), and launch Visual Basic again. You will now be in an SDI environment similar to the one you see in Figure 1.11. To view individual windows and toolbars, you can make selections under the Visual Basic View menu.
|Figure 1.11 The Visual Basic single-document interface (SDI) features free-floating windows, and is good to use when you work on a small screen.
Running Visual Basic Applications
Now that you are a bit more familiar with the Visual Basic design environment, let’s run several Visual Basic applications.
How Computers Remember