VB Ch 6 review
What is a disabled menu item?
A disabled menu item is dimmed or grayed out and can not be selected by the user.
What is the difference between a menu control's access key and its shortcut key?
A menu control's access key only works when the menu is open. The shortcut key works at any time when the form is active.
An ________ usually shows some brief information about the application.
About box
A menu command's ________ only works while the menu is open, while a(n) ________ may be executed at any time while the form is active. a. Shortcut key, access key b. Access key, shortcut key c. Function key, control key d. Alternate key, control key
Access key, shortcut key
This event occurs when the user switches to the form from another form or another application. a. Activated b. Load c. Switch d. Close
Activated
What does the statement Me.Close ( ) do?
Cause the current form to call its own Close method.
Describe the steps for adding a module to a project.
Click Project Click Add Module In the Add New Item window, create a name for the module Click Add
Describe the process of adding a new form to a project.
Click Project select Add Windows Form In the Add New Item window, select Windows Form at the bottom of the Add New Item window, create the form Name Click Add
This method makes a form invisible, but does not remove it from memory. a. Remove b. Delete c. Close d. Hide
Close
Suppose you wish to declare a variable in a module so all the forms in the project have access to it. How should you declare the variable?
Declare the variable as a global variable by using the public keyword.
A context menu displays when the user double-clicks a control. T or F
False
A menu command's shortcut key works only while the menu is open. T or F
False
If you have code that you want to execute every time a form displays, the form's Load event procedure is the best place to write it. T or F
False
It is not possible to access a control on another form in code. T or F
False
This event occurs after a form has closed. a. FormClosed b. EndClose c. ShutDown d. FormClosing
FormClosed
This event occurs as a form is in the process of closing, but before it has closed. a. FormClosed b. StartClose c. ShuttingDown d. FormClosing
FormClosing
The ________ method removes a form from the screen but does not remove it from memory.
Hide
The Show method displays a form in modeless style. T or F
True
In code, how do you determine whether a check mark appears next to a menu item?
If the Checked property is set to True, it means that the item is checked. If the Checked property is set to False, it means that the item is unchecked. The code to check for this value is: mnuItem.checked = True or mnuItem.checked = False ("mnuItem" being the actual name of the menu item).
Just before a form is initially displayed, this event occurs. a. InitialDisplay b. Load c. Display d. Create
Load
A form uses this statement to call its own Close method. a. Form.Close() b. Me.Close() c. Close(Me) d. ThisForm.Close ( )
Me.Close()
If a procedure or variable is used by more than one form, where should it be declared? a. Module b. Form file c. Multiprocess file d. Project file
Module
If you want to declare g_ intTotal in a module as a global variable, which of the following declarations would you use? a. Dim g_ intTotal As Integer b. Public g_ intTotal As Integer c. Global g_intTotal As Integer d. Private g_intTotal As Integer
Public g_ intTotal As Integer
What does the Hide method do? a. Removes a form from the screen and removes it from memory b. Removes a form from the screen but does not remove it from memory c. Positions one form behind another one d. Removes a form from memory but does not remove it from the screen
Removes a form from the screen but does not remove it from memory
Describe the process of removing a form from a project, but not deleting the form file.
Right click on the form in the Solution Explorer window Click Exclude From Project
Describe the process of removing a form from a project and deleting the form file.
Right click the form in the Solution Explorer window Click Delete
Describe the process of changing the startup form to another form.
Right click the project name in the Solution Explorer window Click Properties Select the Application tab Click the down arrow in the startup Form drop down list and select the form to start with. Save and close the properties page.
How do you create a checked menu item?
Set the item's CheckOnClick property to True. Then the checked property to True or False to specify if it shows as checked or not checked when the application runs.
How do you make a menu item disabled?
Set the menu item's Enabled property to False
The ________ method displays a form in modeless style.
Show
The _______ method displays a form in modal style.
ShowDialog
What is the difference between the Load event and the Activated event?
The Load event occurs before the form is displayed. The Activated event happens when the form is initially displayed and when the user switches the focus to the form.
Suppose you want to execute code when a form has fully closed. Where should you place the code?
The code should be placed in the FormClosed event procedure.
Suppose you want to execute code when a form is about to close, but has not fully closed. Where should you place the code?
The code should be placed in the FormClosing event procedure.
Although the Hide method removes a form from the screen, it does not remove it from memory. T or F
True
By default, the first form you create is the startup form. T or F
True
If a menu control does not display a menu or submenu, you make it functional by providing a Click event handler for it. T or F
True
The Activated event executes only once- when the form is initially displayed. T or F
True
The FormClosing event executes before a form has completely closed. T or F
True
When a menu item's ________ property equals True, a check mark appears on the menu next to the item's text.
checked
The ________ method removes a form from the screen and releases the memory it is using.
close
A _______ is a pop-up menu that is displayed when the user right-clicks a form or control.
context menu
You can disable a menu control in code by setting its ________ property to False.
enabled
Modules contain no ________ procedures.
event
Which of the following variable name prefixes do we use in this book for variables that reference forms? a. fr b. frm c. for d. fm
frm
A module-level variable declared Public is also known as a _______ variable.
global
If an application's menu system has a Cut command on the Edit menu, what should the MenuItem control for the command be named? a. mnuCut b. mnuEdit c. mnuCutEdit d. mnuEditCut
mnuEditCut
Which of the following statements disables the mnuFilePrint object? a. mnuFilePrint.Disabled = True b. mnuFilePrint.Enabled = False c. mnuFilePrint.Available = False d. Disable mnuFilePrint
mnuFilePrint.Enabled = False
When a ________ form is displayed, no other form in the application can receive the focus until the form is closed.
modal
When this type of form is displayed, no other form in the application can receive the focus until the form is closed. a. modal b. modeless c. startup d. unloaded
modal
When this type of form is displayed, statements following the method call continue to execute after the form is displayed. a. modal b. modeless c. startup d. unloaded
modeless
A(n) ________ is a variable that holds the memory address of an object and allows you to work with the object.
object variable
When a procedure declaration in a form file begins with ________ , the procedure may only be accessed by statements in the same form.
private
To make a class-level variable available to statements outside the module, you declare it with the ________ keyword.
public
If a form is the _______ , it is displayed first when the project executes.
startup form