Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Customizing Menus And Toolbars

Visual Basic might be nice, but it’s just not set up as you’d like it. You might think, for example, that the Start menu item—to run programs—surely should be in the Edit menu. Well, if you’d like to place it there, it’s possible (just don’t expect anyone else to be able to use Visual Basic after you’ve customized it that way...).

Here’s how you move items between menus or toolbars:

1.  Right-click the menu bar to open the Customize box.
2.  Next, find the menu item you want to add to another menu or to a toolbar; here, we’ll move the Start menu item to the Edit menu.
3.  Using the mouse, drag the menu item from the Customize dialog’s Command box to the new location in a menu or a toolbar, as shown in Figure 2.28, where we drag the Start item to the Edit menu.


Figure 2.28  Add the Start menu item to the Visual Basic Edit menu.

4.  Releasing the mouse adds the menu item to its new location. Finally, click Close in the Customize box to close that dialog.

Besides moving menu items to new locations in menus and toolbars, you can also move whole menus. For example, to move the Edit menu in the menu bar, just open the Customize box and find the Built-in Menus item in the Categories box of the Commands tab. Next, drag the menu you want to move—such as the Edit menu—from the Commands box to its new location in the menu bar. You can move menus to either the menu bar or other toolbars this way.


TIP:  If you use one particular menu item a lot, you might consider moving it directly into the menu bar (where it will appear among all the menu names). You can do that the same way you’d drag that item to a new menu—just drag it into the menu bar instead.

The toolbars in Visual Basic are dockable, of course, so that means you can move them around as you’d like—even above the menu bar. Just grasp the double upright bars at left in the toolbar (Visual Basic uses Explorer-style toolbars) and move the toolbar to its new location.

Setting Forms’ Initial Positions

You’ve completed the project—on schedule and under budget even. But you’re not crazy about where Visual Basic displays the startup form on the screen when the program starts. You can set the form’s Left and Top properties if you like, but there’s an easier and more interactive way using the Form Layout window.

The Form Layout window is part of the IDE, and its default position is at the lower right in the IDE. This window appears in Figure 2.29.


Figure 2.29  Setting a form’s initial position.

Setting a form’s initial position couldn’t be easier—just drag the form into the new location using the mouse. If you want to know the form’s exact new position, watch the first set of numbers in the toolbar—those numbers record the location of the upper left of the form (in twips).


TIP:  Using the Form Layout window, you can even place forms off screen, beyond the edges of the display. That means, of course, that if you want to see the form when the program runs, you’ll have to move it, either by setting its Left and Top properties or with the Move method.

Enabling Or Disabling Quick Info, Auto List Members, Data Tips, And Syntax Checking

Depending on your personal tastes, Visual Basic has a great/terrible set of features/bugs that assist/hobble you while working on your code. These features are as follows:

  Quick Info
  Auto List Members
  Data Tips
  Syntax Checking

The Quick Info feature lets you know what parameters a procedure takes as you’re actually typing the procedure’s name, as in Figure 2.30. This is a useful feature that can save you time looking up parameter order or type.


Figure 2.30  The Visual Basic Quick Info feature.

The Auto List Members feature lists the members of an object as you’re typing the object’s name (actually when you type the dot [.] after the object’s name, as in Figure 2.31). This is useful if you can’t remember exactly what property you want to work with (for example, do I want the Text property, or was it the Caption property?).


Figure 2.31  The Visual Basic Auto List Members feature.

Visual Basic Data Tips are tip tools that appear while you’re debugging a program, and they’re a truly useful innovation. When Visual Basic is in the Debug state, you can let the mouse rest over a variable name in your code, and Visual Basic will display that variable’s current value in a Data Tip, as shown in Figure 2.32.


Figure 2.32  The Visual Basic Data Tips feature.


TIP:  Note that Data Tips can only display the values of simple variables, not complex ones like objects or arrays. For those objects, you must use either the Immediate window or the Watch window.

Syntax Checking speaks for itself—when you move the text insertion point away from a line of Visual Basic code while writing that code, Visual Basic will check the line’s syntax and display an error box if there is an error. That can get annoying if you’re the type of programmer who likes to move around in a file while writing code (“What was the name of that variable again?”).

You can turn all of these features on and off following these steps:

1.  Select the Options item in the Tools menu.
2.  Select the Editor tab in the Options box, as shown in Figure 2.33.


Figure 2.33  Selecting Auto List Members, Data Tips, and more.

3.  Select the options you want from the checkboxes: Auto Syntax Check, Auto List Members, Auto Quick Info, and Auto Data Tips. That’s all it takes.


Previous Table of Contents Next


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.