Chapter 5 Homework Solutions

4
Chapter 5 Homework Solutions: Chapter 5-Menus, Sub Procedures and Sub Functions ANSWERS TO REVIEW QUESTIONS 1. Explain the differenc e between a menu and a submenu. The drop-down list of commands below a menu name (on the Menu bar) is called a menu. When a command on the menu has another list of commands that pops up, the new list is called a submenu. 2. How can the user know if a menu command contains a submenu? A filled triangle to the right of the command indicates that a menu command has a submenu.  3. What is a separator bar and how is it created? A separator bar is a line drawn across the entire menu to separate and group together commands according to their purpose. While in the Menu Editor you can create a separator bar in a menu by typing a single hyphen (-) for the Caption and giving it a name. Even though you can never refer to the separator bar in code, and there is no Click event, you must still give it a unique name.  4. Explain the purpose of the Name and Caption properties of menu items. The Caption property of menu items holds the words you want to appear on the screen in the menu (just like the Caption property of a label or command button). The Name property indicates the name of the menu control, similar to other controls. The Name is required.  5. What does the term common dialog box mean? Common dialog boxes are a set of predefined standard dialog boxes for such tasks as specifying colors and fonts, printing, opening, and saving. The common dialog control, which is a custom control, allows a project to use the dialog boxes that are provided as part of the Windows environment. 6. Name at least three types of common dialog boxes. Common dialog boxes allow the user to select colors and fonts, and to perform duties pertaining to printing, opening, and saving files.  7. Why would you need procedures that are not attached to an event? Situations often occur in which more than one procedure performs the same operation. This condition can occur when the user can select either a command button or a menu option to do the same thing. Rather than retyping the code, y ou can write reusable code in a general procedure and call it from both event procedures. 8. Code the necessary statements to produce a color dialog box and use it to change the background color of a form. Private Sub cmdColor_Click() ‘Display the Color Dialog Box dlgCommon.ShowColor ‘Assign dialog box color to the form 

Transcript of Chapter 5 Homework Solutions

7/31/2019 Chapter 5 Homework Solutions

http://slidepdf.com/reader/full/chapter-5-homework-solutions 1/4

Chapter 5 Homework Solutions: 

Chapter 5-Menus, Sub Procedures and Sub Functions

ANSWERS TO REVIEW QUESTIONS

1. Explain the difference between a menu and a submenu.The drop-down list of commands below a menu name (on the Menu bar) is called a menu.

When a command on the menu has another list of commands that pops up, the new list iscalled a submenu. 

2. How can the user know if a menu command contains a submenu?A filled triangle to the right of the command indicates that a menu command has a

submenu. 

3. What is a separator bar and how is it created?

A separator bar is a line drawn across the entire menu to separate and group togethercommands according to their purpose. While in the Menu Editor you can create a separator

bar in a menu by typing a single hyphen (-) for the Caption and giving it a name. Eventhough you can never refer to the separator bar in code, and there is no Click event, youmust still give it a unique name. 

4. Explain the purpose of the Name and Caption properties of menu items.The Caption property of menu items holds the words you want to appear on the screen in

the menu (just like the Caption property of a label or command button). The Nameproperty indicates the name of the menu control, similar to other controls. The Name is

required. 

5. What does the term common dialog box mean?Common dialog boxes are a set of predefined standard dialog boxes for such tasks as

specifying colors and fonts, printing, opening, and saving. The common dialog control, which isa custom control, allows a project to use the dialog boxes that are provided as part of the

Windows environment. 

6. Name at least three types of common dialog boxes.

Common dialog boxes allow the user to select colors and fonts, and to perform dutiespertaining to printing, opening, and saving files. 

7. Why would you need procedures that are not attached to an event?Situations often occur in which more than one procedure performs the same operation.

This condition can occur when the user can select either a command button or a menu

option to do the same thing. Rather than retyping the code, you can write reusable code ina general procedure and call it from both event procedures.

8. Code the necessary statements to produce a color dialog box and use it to change the

background color of a form.

Private Sub cmdColor_Click()

‘Display the Color Dialog Box 

dlgCommon.ShowColor

‘Assign dialog box color to the form 

7/31/2019 Chapter 5 Homework Solutions

http://slidepdf.com/reader/full/chapter-5-homework-solutions 2/4

7/31/2019 Chapter 5 Homework Solutions

http://slidepdf.com/reader/full/chapter-5-homework-solutions 3/4

12. Give the steps required to convert a project into an EXE file.

To create an EXE file, select the Make ... command from the File menu. The Make ... menuchoice displays the name of the current project and the Make Project dialog box appears. Next,

choose the location and name for your EXE file. You can also set properties for your project by

clicking on the Options button. In the Project Properties dialog box you can specify the version

number, company name, and an icon for your file.

7/31/2019 Chapter 5 Homework Solutions

http://slidepdf.com/reader/full/chapter-5-homework-solutions 4/4