Deck 5: Menus, Common Dialog Boxes, Sub Procedures, and Function

Full screen (f)
exit full mode
Question
Functions perform an action and return a value.
Use Space or
up arrow
down arrow
to flip the card.
Question
Sub procedures can return a value.
Question
If you want the user to be able to use the dialog boxes from the Windows environment so he can save files and change colors,you will need to add two common dialog components to your form,the SaveFileDialog for saving files,and the ColorDialog for changing colors.
Question
The default for passing arguments to function procedures and sub procedures is ByRef.
Question
A function procedure may perform an action,but it only returns a value if the program code requests a value to be returned.
Question
By default,all new menu items have their Enabled property set to True.
Question
You must declare the name of a function as a module-level variable if you want it to return values.
Question
If you click on an item in a menu that is grayed out,you will toggle it on,and it will appear in black text.
Question
After adding a common dialog component to a form,you can display a common dialog box at run time using the OpenDialog method.
Question
It is possible to create procedures that are not associated with click events.
Question
When creating menus with the MenuStrip component,the Name property is used to hold the words that will appear on the screen in the menu bar.
Question
If you use the ShowDialog method to display a common dialog box,the window that is displayed is modal.
Question
When you call a sub procedure or a function procedure,you can send values,called arguments.
Question
When an argument is sent ByVal,a copy of the argument's value is sent to the procedure so that the procedure cannot alter the original value.
Question
Right-clicking on an object will usually pop up a context menu.
Question
An enabled menu item appears in black text and is available for selection.
Question
A function cannot have multiple arguments.
Question
When creating a menu,if an item named "Help" is listed,it should be at the far right and the H should have keyboard access.
Question
The return value from a function procedure is contained in a variable with the same name as the function.
Question
You can pass arguments to sub procedures and function procedures.
Question
Which of the following statements about menus is NOT true?

A)Menu items are displayed in buttons at the top of the window.
B)Create a menu by adding a MenuStrip component to the form.
C)In a menu,submenus will be indicated by a filled triangle to the right of the command.
D)Each item in a menu can have keyboard access.
Question
Which of the following is not a type of common dialog box?

A)Color
B)Save
C)Edit
D)Open
Question
Which property in a menu item's property window is used to change the words that will display in the menu?

A)Name
B)Text
C)Visible
D)Index
Question
Which property of a menu must be set to True if you want an item to have a check mark next to it when the project runs?

A)Selected
B)Enabled
C)Visible
D)Checked
Question
Common Dialog Boxes _______.

A)allow Visual Basic programs to translate the text on the screen into another language
B)display the predefined Windows dialog boxes for open,save,fonts,and colors
C)can only be used on forms with menus
D)allow you to create message boxes that will pop up and prompt the user for text input
Question
Which of the following is NOT true about a menu item that has a check mark?

A)It is currently selected.
B)It can be deselected by changing its Checked property to False.
C)It can be toggled on and off.
D)It is shown in gray.
Question
Which of the following is the method for showing common dialog boxes?

A)ShowDialog
B)ShowOpen
C)ShowPrint
D)ShowColor
Question
Which of the following statements is NOT true?

A)A sub procedure is a procedure that performs actions.
B)A function procedure is a procedure that performs actions.
C)A sub procedure returns a value to the point from which it was called.
D)A function procedure returns a value to the point from which it was called.
Question
Which of the following is the correct way to assign a font to a label using common dialog boxes after the statement FontDialog1.ShowDialog()has been executed?

A)EmployeeLabel.Font = FontDialog1.Font
B)FontDialog1.Font = EmployeeLabel.Font
C)EmployeeLabel.Font FontDialog1.Font
D)FontDialog1.FontName = EmployeeLabel.FontName
Question
If you right-click an object,what type of menu pops up?

A)Menu
B)Control menu
C)Context menu
D)Submenu
Question
Which of the following statements is NOT true?

A)Functions perform an action and then return a value to the point from which they were called.
B)Function procedures and sub procedures can be supplied with arguments.
C)Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef.
D)Sub procedures and function procedures can return values to the point from which they were called.
Question
Assume that you are working on a VB project where you need to change the color of the text in a text box named InformationTextBox.The color is to be selected by the user of the project.Explain which CommonDialog component you need to add to your form,indicate where it appears,and write the code needed to change the color of the text box.
A.Add a ColorDialog component,ColorDialog1.
B.It will appear in the component tray.
C.This is the code to show the dialog box: ColorDialog1.ShowDialog()
This is the code to change the textbox font color -
InformationTextBox.ForeColor = ColorDialog1.Color
Question
Which of the following is NOT true about passing arguments to procedures or functions?

A)Arguments may be passed ByVal or ByRef.
B)An argument that is passed ByRef cannot alter the original value.
C)Specifying ByVal or ByRef is not required when passing arguments.
D)If ByVal or ByRef is not specified,the argument will be sent by value.
Question
Explain the differences between ByVal and ByRef when passing arguments.B.ByRef sends a reference indicating where the value is stored in memory,allowing the called procedure to actually change the argument's original value.
Question
Which of the following statements about context menus is NOT true?

A)A program can have more than one context menu.
B)You can assign the same context menu to more than one control on the form.
C)A context menu can be assigned to a control by setting the control's ContextMenuStrip property.
D)The user can access a context menu on a button by right-clicking on the form.
Question
Which of the following is NOT true about using keyboard access with a menu item?

A)The first menu's Text property should be &File.
B)Do not use the same access key on a main menu name as you use on a form control.
C)When the program is running,use the Alt key with the letter in the menu that is underlined,in order to access that procedure.
D)Menu items will not function correctly if keyboard access is not assigned.
Question
Which of the following is NOT true about menu items in Visual Basic?

A)Menus appear at the top of a window.
B)Menus can contain keyboard access keys.
C)You can add a separator between menu items by using the Line control from the toolbox.
D)Create a menu using the MenuStrip component.
Question
Of the following choices,which CANNOT be done with common dialog boxes?

A)Opening files
B)Selecting fonts
C)Selecting colors
D)Resizing windows
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/38
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 5: Menus, Common Dialog Boxes, Sub Procedures, and Function
1
Functions perform an action and return a value.
True
2
Sub procedures can return a value.
False
3
If you want the user to be able to use the dialog boxes from the Windows environment so he can save files and change colors,you will need to add two common dialog components to your form,the SaveFileDialog for saving files,and the ColorDialog for changing colors.
True
4
The default for passing arguments to function procedures and sub procedures is ByRef.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
5
A function procedure may perform an action,but it only returns a value if the program code requests a value to be returned.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
6
By default,all new menu items have their Enabled property set to True.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
7
You must declare the name of a function as a module-level variable if you want it to return values.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
8
If you click on an item in a menu that is grayed out,you will toggle it on,and it will appear in black text.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
9
After adding a common dialog component to a form,you can display a common dialog box at run time using the OpenDialog method.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
10
It is possible to create procedures that are not associated with click events.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
11
When creating menus with the MenuStrip component,the Name property is used to hold the words that will appear on the screen in the menu bar.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
12
If you use the ShowDialog method to display a common dialog box,the window that is displayed is modal.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
13
When you call a sub procedure or a function procedure,you can send values,called arguments.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
14
When an argument is sent ByVal,a copy of the argument's value is sent to the procedure so that the procedure cannot alter the original value.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
15
Right-clicking on an object will usually pop up a context menu.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
16
An enabled menu item appears in black text and is available for selection.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
17
A function cannot have multiple arguments.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
18
When creating a menu,if an item named "Help" is listed,it should be at the far right and the H should have keyboard access.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
19
The return value from a function procedure is contained in a variable with the same name as the function.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
20
You can pass arguments to sub procedures and function procedures.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
21
Which of the following statements about menus is NOT true?

A)Menu items are displayed in buttons at the top of the window.
B)Create a menu by adding a MenuStrip component to the form.
C)In a menu,submenus will be indicated by a filled triangle to the right of the command.
D)Each item in a menu can have keyboard access.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is not a type of common dialog box?

A)Color
B)Save
C)Edit
D)Open
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
23
Which property in a menu item's property window is used to change the words that will display in the menu?

A)Name
B)Text
C)Visible
D)Index
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
24
Which property of a menu must be set to True if you want an item to have a check mark next to it when the project runs?

A)Selected
B)Enabled
C)Visible
D)Checked
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
25
Common Dialog Boxes _______.

A)allow Visual Basic programs to translate the text on the screen into another language
B)display the predefined Windows dialog boxes for open,save,fonts,and colors
C)can only be used on forms with menus
D)allow you to create message boxes that will pop up and prompt the user for text input
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
26
Which of the following is NOT true about a menu item that has a check mark?

A)It is currently selected.
B)It can be deselected by changing its Checked property to False.
C)It can be toggled on and off.
D)It is shown in gray.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following is the method for showing common dialog boxes?

A)ShowDialog
B)ShowOpen
C)ShowPrint
D)ShowColor
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following statements is NOT true?

A)A sub procedure is a procedure that performs actions.
B)A function procedure is a procedure that performs actions.
C)A sub procedure returns a value to the point from which it was called.
D)A function procedure returns a value to the point from which it was called.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following is the correct way to assign a font to a label using common dialog boxes after the statement FontDialog1.ShowDialog()has been executed?

A)EmployeeLabel.Font = FontDialog1.Font
B)FontDialog1.Font = EmployeeLabel.Font
C)EmployeeLabel.Font FontDialog1.Font
D)FontDialog1.FontName = EmployeeLabel.FontName
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
30
If you right-click an object,what type of menu pops up?

A)Menu
B)Control menu
C)Context menu
D)Submenu
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements is NOT true?

A)Functions perform an action and then return a value to the point from which they were called.
B)Function procedures and sub procedures can be supplied with arguments.
C)Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef.
D)Sub procedures and function procedures can return values to the point from which they were called.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
32
Assume that you are working on a VB project where you need to change the color of the text in a text box named InformationTextBox.The color is to be selected by the user of the project.Explain which CommonDialog component you need to add to your form,indicate where it appears,and write the code needed to change the color of the text box.
A.Add a ColorDialog component,ColorDialog1.
B.It will appear in the component tray.
C.This is the code to show the dialog box: ColorDialog1.ShowDialog()
This is the code to change the textbox font color -
InformationTextBox.ForeColor = ColorDialog1.Color
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following is NOT true about passing arguments to procedures or functions?

A)Arguments may be passed ByVal or ByRef.
B)An argument that is passed ByRef cannot alter the original value.
C)Specifying ByVal or ByRef is not required when passing arguments.
D)If ByVal or ByRef is not specified,the argument will be sent by value.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
34
Explain the differences between ByVal and ByRef when passing arguments.B.ByRef sends a reference indicating where the value is stored in memory,allowing the called procedure to actually change the argument's original value.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following statements about context menus is NOT true?

A)A program can have more than one context menu.
B)You can assign the same context menu to more than one control on the form.
C)A context menu can be assigned to a control by setting the control's ContextMenuStrip property.
D)The user can access a context menu on a button by right-clicking on the form.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following is NOT true about using keyboard access with a menu item?

A)The first menu's Text property should be &File.
B)Do not use the same access key on a main menu name as you use on a form control.
C)When the program is running,use the Alt key with the letter in the menu that is underlined,in order to access that procedure.
D)Menu items will not function correctly if keyboard access is not assigned.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following is NOT true about menu items in Visual Basic?

A)Menus appear at the top of a window.
B)Menus can contain keyboard access keys.
C)You can add a separator between menu items by using the Line control from the toolbox.
D)Create a menu using the MenuStrip component.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
38
Of the following choices,which CANNOT be done with common dialog boxes?

A)Opening files
B)Selecting fonts
C)Selecting colors
D)Resizing windows
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 38 flashcards in this deck.