|
|
|
![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
Creating A Form-Free Startup Procedure To start a program from code not in any form, you add a subroutine named Main() to your program. Follow these steps:
Selecting The Startup Form On the other hand, you might have a number of forms in a projecthow do you specify which one is displayed first? You do that with the General tab of the Project Properties box, just as weve added a Main() subroutine to our program. To specify the startup form for a project, just open the Project Properties box as weve done in the previous section and select the appropriate form in the Startup Object box, as shown in Figure 2.15. Now when your program starts, that form will act as the startup form.
Using Visual Basic Predefined Forms, Menus, And ProjectsYoure designing a new program, and you want a form with a complete File menu on it. You dont want to use the Application Wizard, because that add-in would redesign your whole project for you. Rather than designing a complete standard File menu from scratch, theres an easier way: you can use one of the predefined menus that come with Visual Basic. To add one of the predefined Visual Basic menus, follow these steps:
Besides menus, you can add a whole selection of predefined forms to your projects by finding the Forms folder in the Templates folder in the Visual Component Manager. Here are the available forms, ready to be added to your project with a click of the mouse:
As youll see in the Visual Component Managers Templates folder, you can add the following pre-defined elements to a Visual Basis Project:
After youve created components like these in Visual Basic, you can add them to other projects using the Visual Component Managerin fact, reusing components like this is one of the things professional programmers and programming teams do best. If You Dont Have The Visual Component Manager If your version of Visual Basic does not come with the Visual Component Manager, you can still add many predefined components to a project, including forms, MDI forms, modules, class modules, user controls, and property pages. For example, to add a predefined form to your project, just select Add Form from the Project menu, opening the Add Form dialog box, as shown in Figure 2.18.
As you can see, the predefined forms are here, so you can add them to your project with a simple click of the mouse. Adding menus is a little different here, because you actually add a whole new form with that menu, instead of adding that menu to an already-existing form. For example, to add a new form with a File menu already in place, click the Existing tab in the Add Form dialog box, click the Menus folder, and double-click the Filemenu.frm entry. This adds a new form to your project, complete with File menu.
|
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |