You are previewing Sams Teach Yourself Visual Basic® 6 in 24 Hours.
O'Reilly logo
Sams Teach Yourself Visual Basic® 6 in 24 Hours

Book Description

The niche of this book is that it not only focuses on the topic at hand but it also provides a battery of tools/skills that will take the user at a higher level and help him/her realize the skills “without waiting to read another book” on some other topic they need to know if they wanted to implement it in real life. It is a self contained, stand alone book. Teach Yourself Visual Basic 6 in 24 Hours follows the step-by-step approach of the Teach Yourself series and gives the reader a quick, concise introduction to this programming language. It will explain the basics of Visual Basic through task-oriented examples and a hands on approach. Topics covered include: Basics of Visual Basic development, Understanding the concepts of properties, methods, and events, Creating and implementing ActiveX controls, Integrating data into applications, Adding and manipulating graphics, Testing and debugging applications, Printing from your applications.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Author
  3. Acknowledgments
    1. Tell Us What You Think!
  4. Introduction
    1. Who Should Read This Book
    2. What This Book Will Do for You
    3. Can This Book Really Teach Visual Basic in 24 Hours?
    4. What You Need
    5. Files on the Visual Basic Distribution CD-ROM
    6. Conventions Used in This Book
    7. Enough! Time Is Ticking!
  5. I. Introducing Visual Basic
    1. 1. Visual Basic at Work
      1. What's Visual Basic About?
      2. Languages
      3. Visual Basic's Various Editions
      4. The VB Programming Process
      5. Starting Visual Basic
      6. Stopping Visual Basic
      7. Mastering the Development Environment
        1. Standards: The Menu Bar and Toolbar
        2. The Form Window: Where It All Happens
        3. The Toolbox Supplies Controls
        4. The Form Layout Window Places Forms
        5. The Project Explorer Window
        6. The Properties Window
      8. Help Is at Your Fingertips
      9. Summary
      10. Q&A
      11. Workshop
        1. Quiz
        2. Exercise
    2. 2. Analyzing Visual Basic Programs
      1. Event-Driven Programs
      2. Control Events
      3. Analyzing Sample Applications
      4. Naming Objects
      5. Running Applications
      6. Where's the Code?
      7. Event Procedures
      8. Properties and Event Procedures
      9. Generating an Application from Scratch
      10. Summary
      11. Q&A
      12. Workshop
        1. Quiz
        2. Exercises
    3. 3. Controls and Properties
      1. Creating New Applications
      2. Controls Provide the Interface
        1. Placing Controls
        2. Sizing and Moving Controls
        3. Setting Properties
      3. Giving Your Users Help
      4. Named Literals
      5. Take a Break!
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Exercises
    4. 4. Examining Labels, Buttons, and Text Boxes
      1. Understanding Control Focus at Runtime
      2. The Mouse and Hotkeys Need No Focus
      3. Related Properties
      4. Tab Order
      5. Command Buttons
      6. Labels
      7. Text Boxes
      8. Form Properties
      9. Summary
      10. Q&A
      11. Workshop
        1. Quiz
        2. Exercises
  6. II. Coding the Details
    1. 5. Putting Code into Visual Basic
      1. Coding Basics
      2. Data Basics
        1. Datatypes
          1. Scientific Notation
          2. Specifying Values
        2. Variables Hold Data
        3. Putting Data in Variables
      3. Expressions and Math Operators
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Exercises
    2. 6. Message and Input Boxes
      1. A Function Preview
      2. A MsgBox() and InputBox() Overview
        1. Examining MsgBox()
        2. MsgBox()'s Return Value
      3. Visual Basic's Code Window Help
      4. A Short Detour: Remarks
      5. Examining InputBox()
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Exercises
    3. 7. Making Decisions
      1. Comparison Operators
        1. The Comparison's Nature
        2. Keep Each Side's Datatype Consistent
      2. The If Statement
      3. The If Statement's Else Branch
      4. Compound Comparisons with the Logical Operators
      5. Multiple Choice with Select Case
      6. Two Additional Select Case Formats
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Exercises
    4. 8. Visual Basic Looping
      1. The Do While Loops
      2. The Do Until Loop
      3. The Other Do Loops
      4. The For Loop
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
  7. III. Putting Code to Work
    1. 9. Combining Code and Controls
      1. The Interest Calculation Application
      2. Using Control Arrays
      3. Finishing the Form
      4. Adding Code
      5. The Unload Statement
      6. Finishing Touches
      7. Error Checking
      8. Summary
      9. Q&A
      10. Workshop
        1. Quiz
        2. Exercises
    2. 10. List Boxes and Data Lists
      1. The List Box Control
      2. Combo Boxes
      3. Data Arrays
      4. Control Arrays
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
    3. 11. Additional Controls
      1. Option Buttons
      2. Frames and Option Buttons
      3. Check Boxes
      4. Scrollbars
      5. VB's Clock: The Timer Control
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Exercises
    4. 12. Dialog Box Basics
      1. What the Common Dialog Box Does
      2. Adding the Common Dialog Box Control
      3. Generating Common Dialog Boxes
      4. The Common Dialog Box Methods
      5. Adding the File Dialog Boxes
      6. The Color Dialog Box
      7. The Font Dialog Box
      8. The Printer Dialog Box
      9. Summary
      10. Q&A
      11. Workshop
        1. Quiz
        2. Exercises
  8. IV. Programming with Data
    1. 13. Modular Programming
      1. Structured Programming
      2. Calling Procedures and Returning from Them
      3. Coding Subroutines
      4. Coding Functions
      5. Coding Arguments
      6. Receiving by Reference and by Value
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Exercises
    2. 14. Built-In Functions Save Time
      1. Many Functions
      2. Numeric Functions
      3. String Functions
      4. Date and Time Functions
      5. Data-Testing Functions
      6. Data Conversion Functions
      7. Format Function
      8. Summary
      9. Q&A
      10. Workshop
        1. Quiz
        2. Exercises
    3. 15. Visual Basic Database Basics
      1. File Concepts
        1. Opening Files
        2. Closing Files
        3. Deleting Files
        4. Writing to Files with Write #
        5. Inputting with Input #
        6. Line Input Records
      2. Introduction to Database Processing
        1. The Data Control
        2. A Simple but Powerful Application
      3. The Data Form Wizard
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Exercises
    4. 16. Printing with Visual Basic
      1. Introducing Printing
      2. Preparing the User for Printing
      3. Introducing the Printer Object
      4. The Print Method
        1. Printing Literals
        2. Printing Variables and Controls
        3. Printing Expressions
        4. Printing Multiple Values
        5. Using the Fonts
        6. Better Spacing with Spc() and Tab()
      5. Starting to Print
        1. Page Breaks
      6. Summary
      7. Q&A
      8. Workshop
        1. Quiz
        2. Exercises
  9. V. Sprucing Up Programs
    1. 17. Menus and Visual Basic
      1. The Menu Editor
      2. Adding an Application's Menu Bar
      3. Naming Menu Options
      4. Adding Pull-Down Menu Options
      5. Menu Extras
      6. Connecting Menus to Event Procedures
      7. Copying Menus Between Projects
      8. Summary
      9. Q&A
      10. Workshop
        1. Quiz
        2. Exercises
    2. 18. The Graphic Image Controls
      1. The Image Control
        1. Preparing the Image
        2. Sizing the Image
        3. Loading Pictures at Runtime
      2. The Picture Box Control
      3. Animating Pictures
      4. Summary
      5. Q&A
      6. Workshop
        1. Quiz
        2. Exercises
    3. 19. Toolbars and More Graphics
      1. Preparing for the Toolbar
      2. The Image List Control
      3. Finalizing the Toolbar
      4. The Line and Shape Controls
        1. The Line Control
        2. Mastering the Line Control
        3. Mastering the Shape Control
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
    4. 20. Writing Correct Applications
      1. Kinds of Errors
      2. The Debugger
      3. Setting Breakpoints
      4. Stepping Through Code
      5. The Call Stack Shows Where You've Been
      6. The Immediate Window
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Exercises
  10. VI. Advancing Visual Basic Applications
    1. 21. Visual Basic and ActiveX
      1. ActiveX: The Tools You Use
      2. Building ActiveX Controls With VB
      3. OLE Processing
        1. Creating Inserted Objects
        2. Inserting Existing Objects
      4. ActiveX Documents
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
    2. 22. Object Basics
      1. The System Objects
      2. Program Objects
      3. Using Collections and Object Arrays
      4. Introduction to OLE Automation
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
    3. 23. Distributing Your Applications
      1. Compiling Your Application
      2. Setting Project Properties
      3. Setting Up Your Application
      4. Starting the Package And Deployment Wizard
      5. Running Setup
      6. Uninstalling the Application
      7. Summary
      8. Q&A
      9. Workshop
        1. Quiz
        2. Exercise
    4. 24. Online Visual Basic
      1. Follow the Wizard to the Web!
      2. Your Users Need an ISP
      3. Using the Browser
      4. Looking Through the Other Tools
      5. Summary
      6. Q&A
      7. Workshop
        1. Quiz
        2. Exercises
  11. VII. Appendixes
    1. A. Operator Precedence
    2. B. Answers
      1. Hour 1. Quiz
      2. Hour 1. Exercise
      3. Hour 2. Quiz
      4. Hour 2. Exercise
      5. Hour 3. Quiz
      6. Hour 3. Exercise
      7. Hour 4. Quiz
      8. Hour 4. Exercise
      9. Hour 5. Quiz
      10. Hour 5. Exercise
      11. Hour 6. Quiz
      12. Hour 6. Exercise
      13. Hour 7. Quiz
      14. Hour 7. Exercise
      15. Hour 8. Quiz
      16. Hour 8. Exercise
      17. Hour 9. Quiz
      18. Hour 9. Exercise
      19. Hour 10. Quiz
      20. Hour 10. Exercise
      21. Hour 11. Quiz
      22. Hour 11. Exercise
      23. Hour 12. Quiz
      24. Hour 12. Exercise
      25. Hour 13. Quiz
      26. Hour 13. Exercise
      27. Hour 14. Quiz
      28. Hour 14. Exercise
      29. Hour 15. Quiz
      30. Hour 15. Exercise
      31. Hour 16. Quiz
      32. Hour 16. Exercise
      33. Hour 17. Quiz
      34. Hour 17. Exercise
      35. Hour 18. Quiz
      36. Hour 18. Exercise
      37. Hour 19. Quiz
      38. Hour 19. Exercise
      39. Hour 20. Quiz
      40. Hour 20. Exercise
      41. Hour 21. Quiz
      42. Hour 21. Exercise
      43. Hour 22. Quiz
      44. Hour 22. Exercise
      45. Hour 23. Quiz
      46. Hour 23. Exercise
      47. Hour 24. Quiz
      48. Hour 24. Exercise
    3. C. Using the CD-ROM
      1. Windows 95/NT 4 Installation Instructions
        1. System Requirements