Sams Teach Yourself Visual Basic 6 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Introduction
- Who Should Read This Book
- What This Book Will Do for You
- Can This Book Really Teach Visual Basic in 24 Hours?
- What You Need
- Files on the Visual Basic Distribution CD-ROM
- Conventions Used in This Book
- Enough! Time Is Ticking!
- Part I: Introducing Visual Basic
- Hour 1. Visual Basic at Work
- Hour 2.Analyzing Visual Basic Programs
- Hour 3.Controls and Properties
- Hour 4.Examining Labels, Buttons, and Text Boxes
- Part II: Coding the Details
- Hour 5.Putting Code into Visual Basic
- Hour 6.Message and Input Boxes
- Hour 7.Making Decisions
- Hour 8.Visual Basic Looping
- Part III:Putting Code to Work
- Hour 9.Combining Code and Controls
- Hour 10.List Boxes and Data Lists
- Hour 11.Additional Controls
- Hour 12.Dialog Box Basics
- Part IV:Programming with Data
- Hour 13.Modular Programming
- Hour 14.Built-In Functions Save Time
- Hour 15.Visual Basic Database Basics
- Hour 16.Printing with Visual Basic
- Part V:Sprucing Up Programs
- Hour 17.Menus and Visual Basic
- Hour 18.The Graphic Image Controls
- Hour 19.Toolbars and More Graphics
- Hour 20.Writing Correct Applications
- Part VI:Advancing Visual Basic Applications
- Hour 21.Visual Basic and ActiveX
- Hour 22.Object Basics
- Hour 23.Distributing Your Applications
- Hour 24.Online Visual Basic
- Part VII:Appendixes
- Appendix A.Operator Precedence
- Appendix B.Answers
- Appendix C.Using the CD-ROM
Giving Your Users Help
The ToolTip is a great feature that helps your users and is as easy to implement as typing text into the control's ToolTipText property. Most applications since the introduction of Windows 95 include ToolTips, and there's no reason why your applications should not include them as well.
Figure 3.5 shows a ToolTip that appears in Visual Basic when you rest the mouse pointer over the Form Layout Window toolbar button. The best time to add ToolTip text is when you adjust a new control's properties because you are more likely to remember the primary purpose for the control. Often programmers intend to add these helpful items later, after they "complete" the application, but then the items are never added.
Figure 3.5 The ToolTip pops up to describe the project.
If you want to change a property value, such as the Name property, you can click the property and enter a new value. As you type, the new value replaces the original value. If instead of clicking you double-click the property, Visual Basic highlights the property value and lets you edit the existing value by pressing your cursor keys and using Insert and Delete to edit the current property value.
Some properties require a selection from a drop-down list box. For example, Figure 3.6 shows a command button's Visible property's drop-down list box. The Visible property can either be True or False. No other values work for the property, so Visual Basic lets you select from one of those two values when you click the property value to display the down arrow and open the drop-down list box.
Figure 3.6 Some properties require a selection from a list box.
If an ellipsis (…) is displayed when you click the property value, such as the Font property when you click the current Font property's value, a dialog box opens when you click the ellipsis. A Font property is more than just a style name or size. The control's Font property can take on all kinds of values. And the Font dialog box that appears from a click of the ellipsis lets you specify all available Font property parts. When you close the dialog box, the compound property is set to the dialog box's specific values.
Some programmers prefer the Categorized view of the Properties window. By default, the Properties window displays its properties alphabetically (with a possible exception at the top of the Properties window, such as the Name property). When you click the Categorized tab above the property values, the Properties window changes to show the properties in an Explorer tree view such as the one in Figure 3.7.
Figure 3.7 These property values appear by category type.
If you needed to change all of a control's appearance values, such as Color and Caption, you could expand the Categorized view's Appearance entry to display all the appearance values together. That way, you can change the appearance more quickly than if you had to search through the alphabetical listing of properties.
As you can see, placing a control requires much more involvement with property values than simply moving and sizing the control. You rarely if ever have to change all the properties of a control because many default values work fine for most applications. Nevertheless, many property values work to make the control unique to your specific application.
Named Literals | Next Section

Account Sign In
View your cart