| 1: || |
In one sentence , define an event handler.
| A1: || |
An event handler is simply a procedure that is responsible for carrying out the task associated with a given event.
| 2: || |
What is the syntax format for an event handler?
| A2: || |
Private Sub CtrlName_ThisEvent(Args) Handles MyBase.ThisEvent
is the signature for the ThisEvent event for the CtrlName control. This statement form tells Visual Basic .NET that this subroutine processes the ThisEvent control event.
| 3: || |
What is the purpose of the AcceptButton property?
| A3: || |
The AcceptButton property links the pressing of the Enter key to a specific button that exists on the form. In other words, if the user presses the Enter key and you want that action to cause the program to behave as though the btnSave button were pressed, you would enter btnSave in the AcceptButton property field. After this is done, if the user presses the Enter key, the program will respond as if the user had clicked the btnSave button.
| 4: || |
What is the purpose of the CancelButton property?
| A4: || |
The concept is the same as the AcceptButton property, but in this case you are associating the Esc (Escape) key with a button's Click event. Usually, CancelButton is tied to the btnExit button. Therefore, the CancelButton property is normally set to the btnExit button. If the user presses the Esc key while the program is running, the form is dismissed.
| 5: || |
How might the Show and Hide methods be used in a program?
| A5: || |
There will be times when you have a sequence of forms that must be filled in by the user. Rather than load these forms as they are needed, the programmer can load them all when the program first starts. After all the forms are loaded, the program can use the Show() method to display the first form. After the form is completed by the user, you can use the Hide() method to dismiss the current form and use the next form's Show() method to display the next form, and so on for all the forms. By using the Hide() method rather than the Dispose() method, you can redisplay any form as needed with a simple Show() method call rather than reloading the form.
| 6: || |
What is the purpose of the TabIndex property?
| A6: || |
The TabIndex property determines one of two things. First, if the form is just now being displayed, the control that has the lowest TabIndex value is the control that will receive the program focus when the form is first displayed. Second, the TabIndex property determines where program control goes after the user presses the Tab key.
If you are designing a form and double-click on a TextBox control on the Windows Form tab of the Toolbox, Visual Basic .NET automatically places a copy of the TextBox control on the form. If this is the first control on the form, the TabIndex property for the TextBox is set to 0. This means that, when the program is run, this text box will receive the program focus when the form is displayed.
If you double-click on the TextBox control a second time, the TabIndex property is set to 1 . In other words, the TabIndex property is automatically incremented by 1 for the next control added to the form. It also follows that this second text box would receive the program's focus when the user presses the Tab key while the cursor is in the first text box.
| 7: || |
Why do you often find radio buttons contained within a GroupBox control?
| A7: || |
Radio buttons are normally used for a mutually exclusive list of program options. That is, if you select the option associated with one radio button, you automatically exclude any and all other radio button options. If the radio buttons are placed on a GroupBox control, the radio buttons are treated collectively as a mutually exclusive option list. This simplifies the code necessary to process such option lists.
| 8: || |
How do you allow for multiple sections from a list box?
| A8: || |
Set the SelectionMode property to MultiSimple . You can then use the GetSelected() method to determine which items in the list box have been selected.