Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Workshop

The quiz questions and exercises are provided for your further understanding. See Appendix B for the answers.

Quiz

  1. How many different dialog boxes can the Common Dialog Box control produce?

  2. What are two advantages to using the Common Dialog Box control over your own dialog boxes that you create?

  3. True or false: You can add an ActiveX control to your toolbox.

  4. True or false: Visual Basic includes these five controls that you can add to your toolbox: File Open, File Save, Colors, Font, and Help.

  5. What property limits the files displayed to a particular set of extensions?

  6. Name the methods that display all six common dialog boxes.

  7. Why does the following code not display a Font dialog box?

    cbdDialog.DialogTitle = "Font"
    cbdDialog.ShowFont
    
  8. How do you know which file was selected by the user after a File Save dialog box closes?

  9. True or false: The Color dialog box limits the user to a few limited color values.

  10. Why does a file not begin printing as soon as the user selects a printer and closes the Printer dialog box?

Exercises

  1. 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.
  2. 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.
  3. 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?
  4. 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.

Share ThisShare This

Informit Network