Review Questions


In one sentence , define an event handler.


An event handler is simply a procedure that is responsible for carrying out the task associated with a given event.


What is the syntax format for an event handler?


The statement

 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.


What is the purpose of the AcceptButton property?


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.


What is the purpose of the CancelButton property?


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.


How might the Show and Hide methods be used in a program?


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.


What is the purpose of the TabIndex property?


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.


Why do you often find radio buttons contained within a GroupBox control?


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.


How do you allow for multiple sections from a list box?


Set the SelectionMode property to MultiSimple . You can then use the GetSelected() method to determine which items in the list box have been selected.

Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: