Defining IDEIDE is an acronym for Integrated Development Environment. The IDE is the workbench on which you make your programs in Visual Basic.
The Visual Basic IDE is a collection of menus, toolbars, and windows that make up your programming workbench (see Figure 3.1). Each part of the IDE has features that affect different aspects of your programming activity. The menu bar lets you direct the overall activity and management of your programming. The toolbar enables you to access much of the menu bar's functionality through various toolbar buttons. Forms--the basic building blocks of Visual Basic programs--are presented in a Form window. You use the ToolBox to add controls to the forms of your project. The Project Explorer displays the projects on which you're working, as well as the different parts of each of those projects. You browse and set a control, form, and module's properties within the Properties window. Finally, you position and view a form or forms onscreen within the Form Layout window.
FIGURE 3.1 The VB IDE is the programmer's workbench.
Toolbars are collections of small iconic buttons that reside in a bar underneath the menu bar. These buttons offer access to the most commonly used functions that you have in the Visual Basic menu structure. Toolbars are useful because rather than have to negotiate menus and submenus to do what you want, you click a specific button in the toolbar to call a specific functionality in the Visual Basic IDE.
ToolTipsToolTips are little windows that appear when you hold the mouse pointer over a control or toolbar button for a few seconds. Inside these windows is some text that tells you what the control or toolbar button is about.
Toolbars usually reside under the menu and can be grouped into a single bar. Also, you can drag a toolbar onto the IDE's Code and Form windows to have it "float" for more convenient access.
Add or remove a toolbar to or from the IDE
FIGURE 3.2 You select a predefined toolbar type by right-clicking the VB toolbar.
You use the Debug toolbar (see Figure 3.3) to test your program and resolve errors that might occur. When you debug a program, you do things such as run the code a line at a time, examine the values of variables, and stop the code at certain critical points or under certain conditions. For an in-depth discussion of debugging, see Chapter 21, "Debugging Your Applications."
You use the Edit toolbar (see Figure 3.4) when you're working with code in a Code window. The features of the Edit toolbar are similar to those of the Edit menu. You can Cut and Paste text. You can manipulate the layout of your code and do text selection, searches, and replacement. Also, you can use automatic coding features such as Quick Info.
An interesting VB IDE feature that the Edit toolbar uses is the Complete Word feature (also trademarked by Microsoft as Intelli-sense). This feature automatically completes a keyword for you. For example, if you were to type Ms into a code window and then invoke the Complete Word feature, Visual Basic would complete the word as MsgBox, an intrinsic Visual Basic function that displays a Windows message box. The Complete Word feature is very useful for avoiding syntax errors due to misspelling. For more information about the specifics of debugging, see Chapter 21.
FIGURE 3.3 The Debug toolbar enables you to access the debugging functions of the Visual Basic IDE.
FIGURE 3.4 You can access the extended Edit menu and some Debug menu functions from the Edit toolbar.
You use the Form Editor toolbar (see Figure 3.5) to size, move, and align controls on a form. The Form Editor toolbar has the same set of features as the Format menu.
FIGURE 3.5 You align and size multiple controls on a form with the Form Editor toolbar.
Notice the small downward-facing arrowheads to the right of the Align, Center, and Make toolbar buttons. These arrowheads indicate that a drop-down menu will appear when you select that toolbar button.
Working with forms and controls requires that sometimes you have to work with the ZOrder property of a control. ZOrder determines which control has the "right" to supersede the position of another control. Sometimes you might want one control to appear over another--an OptionButton over a PictureBox, for instance. You can accomplish this by dragging the OptionButton over the PictureBox. Alternatively, in code, you can set the value of the OptionButton's ZOrder property to 0. Then, no matter where you place the control at design time, the OptionButton will always be on top. When you place one control over another on a form, you're affecting each control's ZOrder property. The Z order determines the "top most-ness" of a control. Controls with a ZOrder value of 0 are always on top; however, if two controls each have a ZOrder value of 0, they nullify each other.
The standard toolbar (see Figure 3.6) is the central toolbar in the Visual Basic IDE. The standard toolbar offers many features found in the File, Project, Debug, and Run menus.
FIGURE 3.6 The standard toolbar gives you fast access to often-used functionality and information.
Controls are the building blocks with which you assemble your Visual Basic program. The ToolBox is a palette of controls, and you build your user interface by selecting controls from the ToolBox and placing them on your forms (see Figure 3.7).
Some controls are built into Visual Basic and can't be removed from the ToolBox; these controls reside within Visual Basic itself. These controls are known as intrinsic controls. Others live outside Visual Basic and reside in files that end with the extension .ocx. These controls can be added and removed from the ToolBox.
A full discussion of the ToolBox, intrinsic controls, and ActiveX controls takes place in Chapter 4, "Using the Intrinsic Controls."
FIGURE 3.7 This ToolBox shows both intrinsic controls and the extra ActiveX controls that ship with Visual Basic 6.
Just as controls are the building blocks that you use to assemble your Visual Basic program, a Visual Basic form is the foundation on which you build with those blocks. Forms reside in the Form Designer window (see Figure 3.8). You work in the Form Designer window to add controls to your form.
FIGURE 3.8 The Form Designer window is where you create forms for your Visual Basic programs.
For each Form Designer window, you can also open a Code window. Code windows are where you work with the Visual Basic code that you write "behind" your form (refer to Figure 3.8). You open a code window by double-clicking a form or a control on the form. You also can open a code window by choosing Code from the View menu. For how to access Code windows, review the process described for the application that you made in Chapter 1, "Building Your First Application."
The Project Explorer in Visual Basic 6 helps you manage and navigate multiple projects. Visual Basic enables you to organize multiple projects into groups called project groups. You can save the collection of projects in your Visual Basic session into a project group file. Project Group files end with the extension .vbg.
The Project Explorer is a hierarchical tree-branch structure. Projects are at the top of the tree, and the project parts (forms, modules, and so on) descend from the tree. If you want to work on a particular part, you double-click the part to display it. If you want to see the part in a particular view--say, a form in a Code window--you select the form by clicking it once. Then click the View Code icon at the top of the Project Explorer window (see Figure 3.9).
FIGURE 3.9 You can work with multiple projects in the Project Explorer window.
As you become a more adept programmer and the scope and size of your programs grow to include multiple projects, you'll find the Project Explorer to be an extremely useful tool for doing large-scale programming. For example, if want to add a form to your project, you can do so by using the Project Explorer.
Add a form from the Project Explorer
FIGURE 3.10 You can add or remove projects, forms, and modules to or from the Project Explorer by using its context menu.
Properties and valuesThe programming jargon for a property's setting is a property's value.
In the Properties window, you read, configure, and control the initial settings of the ActiveX controls in your program. As you become more familiar with Visual Basic programming, a good portion of your time will be spent learning, setting, and manipulating control properties. Because controls are the building blocks of Visual Basic programs, the Properties window is an essential tool to master. Figure 3.11 shows the structure of the Properties window.
FIGURE 3.11 You set the attributes of a control with the Properties window.
The Form Layout window enables you to set the runtime position of one or more forms onscreen.
You position a form by moving its representation on the "computer screen" in the Form Layout window with your mouse. As you move the pointer over the small form in the Form Layout window, the pointer changes into a four-directional, arrow-headed cross. To position the screen, hold down your mouse button and drag the form to where you want it to be on the computer screen (see Figure 3.12).
FIGURE 3.12 The Form Layout window lets you position one or more forms as they appear onscreen.
The Form Layout window is a little tricky to use. Remember, the placement of a form in the Form Designer window doesn't affect the screen position of your program's form at runtime. If the IDE is in MDI display mode, you set the runtime startup position of a form in the Form Layout window. When the IDE is in SDI display move, there's no display of a Form Layout window. Thus, the position of the form onscreen is the startup position of the form at runtime.
MDI versus SDIMDI stands for multiple document interface; SDI stands for single document interface. A multiple document graphical user interface is one that allows you to view multiple windows within a larger window--various Word document windows within the Word application window, for example. A single document interface is one where all windows appear independently of one another without the unification of a single parent window.
You can view the Visual Basic IDE in two ways: with the multiple document interface (MDI) or the single document interface (SDI). MDI view shows all the distinct windows of the Visual Basic IDE as member windows within one large IDE window (refer to Figure 3.1).
In the SDI view (shown in Figure 3.13), distinct windows of the Visual Basic IDE exist independently of each other. There's no master window to contain and provide a unified feel to the IDE. Some people who've worked with previous versions of Visual Basic find working with the IDE in an SDI view a little bit easier in that it's similar to the earlier versions' environment; others find the unified layout of the MDI environment more appealing. There's no better or worse way; it's all a matter of work style.
FIGURE 3.13 The SDI view is the way the VB IDE looked before version 5.
Change from MDI view to SDI view
FIGURE 3.14 You custom configure the IDE from within the Options dialog box.
© Copyright, Macmillan Computer Publishing. All rights reserved.