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
Workshop
The quiz questions and exercises are provided for your further understanding. See Appendix B for the answers.
Quiz
-
How many different dialog boxes can the Common Dialog Box control produce?
-
What are two advantages to using the Common Dialog Box control over your own dialog boxes that you create?
-
True or false: You can add an ActiveX control to your toolbox.
-
True or false: Visual Basic includes these five controls that you can add to your toolbox: File Open, File Save, Colors, Font, and Help.
-
What property limits the files displayed to a particular set of extensions?
-
Name the methods that display all six common dialog boxes.
-
Why does the following code not display a Font dialog box?
cbdDialog.DialogTitle = "Font" cbdDialog.ShowFont
-
How do you know which file was selected by the user after a File Save dialog box closes?
-
True or false: The Color dialog box limits the user to a few limited color values.
-
Why does a file not begin printing as soon as the user selects a printer and closes the Printer dialog box?
Exercises
- Press Ctrl+T to display the Components dialog box once again. Search through the controls you can add to your toolbox. Add a few interesting controls and study their properties. You can add as many as you want. You also can delete one of these extra controls from the Toolbox window by pressing Ctrl+T and deselecting it.
- Write a simple Color dialog box application that lets the user display a Color dialog box simply by clicking a command button. When the user selects a color and closes the Color dialog box, set the command button's BackColor property to the user's selected color.
- Run the application you created in exercise 2 and click the Define Custom Colors button to see how the Color dialog box changes. Aren't common dialog boxes simple to use?
- Display a File Open dialog box (attach the display to a command button so you can display the dialog box when you are ready) that displays, by default, all files in the selected folder that end with .txt and .bat extensions. Set the default folder to your computer's root directory (C:\) and make Autoexec.bat the default filename selected when the user first sees the dialog box.
Part IV:Programming with Data | Next Section

Account Sign In
View your cart