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
Q&A
-
Can I use graphic images other than the ones that Visual Basic supplies?
Certainly. Both the Image control and the Picture Box control load images from any file that uses one of Table 18.1's graphic file formats. As a matter of fact, Visual Basic's images are fairly limited, and most of them are useful for command button pictures and toolbars but very little else.
-
Did you just say command button pictures? When I click the command button's Picture property, no picture appears on the command button, so what's wrong?
This is as good a time as any to describe how to put pictures on command buttons. After you set the command button's Picture property, you must also set the Style property to 1-Graphical. Only a graphical command button can display pictures. The command button works just like before, but now a picture appears. (Erase the Caption property if the caption overwrites the picture's image.) You did not learn about command button pictures in earlier lessons because you were not yet familiar with the LoadPicture() function. You can use LoadPicture() to insert a picture on a command button at runtime if you need to do that. Often, programmers will display a slightly different picture on a command button after the user clicks the button, and you can use LoadPicture() to do the same.
-
If speed is no longer an issue, why should I ever use the Image control?
Although the Image control is slightly more efficient, you are correct in remembering that today's computers are generally fast enough to handle both the Picture Box control and the Image control for any application. If, however, you work in a networked environment or if you set up your Windows desktop to run several applications simultaneously, you will want to utilize all resources as efficiently as possible. Therefore, you might prefer to use the Image control to lessen your computer's load if you don't need the Picture Box control's extra properties, events, and methods.
Workshop | Next Section

Account Sign In
View your cart