Visual Basic 2 - Chapter 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Once a button has been added to a ToolStrip, what property identifies the image to be displayed on the button?

Image

Which ToolStripButton property determines whether the button image will be sized to the button's default size?

ImageScaling

Char Data Type

The Char data type holds some useful tools for string manipulation and validation. Internally, a Char holds a single 16-bit Unicode character.

KeyPress Event

The TextBox control fires a KeyPress event each time the user presses a key while the input focus is on the control.

FolderBrowserDialog Control

Displays a list of folders and lets the user select one. Input Validation - Whenever possible, applications should do their best to detect and handle errors resulting from user input.

SplitContainer Control

Divides the display area into separate panels when using controls that occupy a great deal of space on forms.

How many bits are used to represent a Char type object?

16

StatusStrip Control

A message display found in the Menus & Toolbars section, that allows stuff to be displayed without interrupting the user.

Software Wizard

A user interface that leads the user through a series of predescribed steps.

If you want to get a list of all the images on a Web page, which property must you access first?

Document

Which event fires when the WebBrowser has finished loading a Web page document?

Document Completed

If you want to add 10 days to the current date, which DateTime method should you call?

AddDays

Which method adds N days to a DateTime object?

AddDays

System Exception Class

All exception classes are related to this.

What type of exception should be thrown by methods in your classes?

ApplicationException

Which exception is thrown when an array subscript is out of bounds?

ArgumentOutOfRangeException

TextChanged Event

Associated with the TextBox control, this fires every time the user changes its contents. The event can also fire if a program statement modifies the Text property.

Finally Block

Begins with Finally and ends with End Try. IF no exceptions are thrown, the Finally block executes immediately after the last statement in the Try block. If an exception is thrown, the Finally block executes immediately after the last statement in the appropriate Catch block.

Name all the control types you can insert in a ToolStrip control.

Button, Label, SplitButton, DropDownButton, Separator, ComboBox, TextBox, ProgressBar

How do you convert a character to uppercase?

Call Char.ToUpper

How do you find out if a character is a control character, such as Backspace?

Char IsControl

Which shared method in the Char class returns a specific character in a string?

Chars

Which collection in the CheckedListBox control contains a list of the indexes of all checked items?

CheckedIndicies

List-Type Control

Control type that includes the ListBox, ComboBox, and CheckedListBox controls.

Which control is shown in this chapter as a way for the user to select a date from a calendar-like display?

DateTimePicker Control

Declare a TimeSpan object named duration that equals 2 hours, 30 minutes, and 5 seconds.

Dim duration as New Timespan(2, 30, 5)

If you want to display text in a ToolStripButton, which property must be set to Text?

Display Style

Which ToolStripButton property determines whether the button will display an image, text, or both?

DisplayStyle

(T/F) When a Catch block finishes executing, execution resumes in the Try block where the exception was thrown.

False

Which control provides a visual cue to the validation status of an input field?

ErrorProvider

Exception Handling: An exception is usually handled by alerting the user, retrying the operation that caused the error, or by terminating the application.

Exception Handling: Exceptions are objects. In other words, a program that throws an exception is really throwing an instance of one of the .NET exception classes.

Exception Handling: Most often, a program handles exceptions that were caused by a user's invalid input. When possible, try to prevent exceptions by checking all input.

Exception Handling: Handling an exception is accomplished using a Try-Catch-Finally statement.

Input Validation: The ErrorProvider control provides a simple way to validate input fields by displaying an icon and error message for any field containing invalid data.

Exception Handling: When a program encounters an error while running, we say that an exception was thrown. Sometimes, the error is severe enough to cause the application's behavior to become unreliable.

(T/F) A separate ErrorProvider control is required for each TextBox on a form.

False

(T/F) After a Catch block executes, any remaining statements in the Try block are executed.

False

(T/F) An exception must be caught inside the same method as the method throwing the exception.

False

(T/F) If an exception is thrown inside a Try block, all statements in the Try block execute anyway.

False

(T/F) Only the first Catch block (in a series of Catch blocks) is permitted to catch an ApplicationException.

False

(T/F) The Leave event fires when the input focus moves away from a control.

False

(T/F) The SetError method of the ErrorProvider method has a single parameter, which is a string.

False

(T/F) To convert a string to a Char array, call the MakeArray method.

False

FlowLayoutPanel, WebBrowser, SplitContainer, and TabControl: The SplitContainer control divides a form into panels. At runtime, the user can change the sizes of panels by dragging a splitter bar.

FlowLayoutPanel, WebBrowser, SplitContainer, and TabControl: The TabControl is a control that provides a convenient way for you to divide a form into separate pages. Each page (a TabPage object) belong to a TabPage Collection stored in the property named TabPages.

FlowLayoutPanel, WebBrowser, SplitContainer, and TabControl: The FlowLayoutPanel control is a general-purpose container into which you can insert any type of control.

FlowLayoutPanel, WebBrowser, SplitContainer, and TabControl: The WebBrowser control displays online Web pages and local HTML document files.

Which DateTimePicker property controls whether a date or time is displayed?

Format

What type of exception is thrown when the format of an argument passed to a method does not match the format of the formal parameter?

FormatException

Which WebBrowser method returns to the previously displayed Web Page?

GoBack

CheckedListBox Control

Has the same properties and behavior as a ListBox, except that it displays a check box next to each term.

Catching An Exception

How you handle a thrown exception.

Uncaught Exception

If the exception causes the program to stop, we call it an unhandled or uncaught exception.

Unhandled Exception

If the exception causes the program to stop, we call it an unhandled or uncaught exception.

Which WebBrowser control method opens a Web page?

Navigate

Which WebBrowser method must you call when displaying a Web page?

Navigate

Must a Catch block include an exception object variable?

No, the variable is optional.

Input Validation: The TextChanged event associated with the TextBox control fires each time the user changes its contents. The TextBox control also fires a KeyPress event every time the user presses a key while the input focus is on the control.

Input Validation: The StatusStrip control is the ideal container for displaying status and error messages to the user.

Input Validation: Applications should do their best to detect and handle errors resulting from user input.

Input Validation: When performing input validation, you will often use methods from the Char class. One use for char methods is when scanning a string to look for certain classes of characters. Another way to use Char methods is when you are validating keyboard input.

Which Char method checks if a character is a member of the alphabet?

IsLetter

Which shared method in the Char class tells you if a character is either a letter or a number?

IsLetterOrDigit

What is the purpose of the CheckOnClick property in the CheckedListBox control?

It lets the user check the item as soon as it is clicked.

How can an application continue to run when an exception has been thrown?

It may continue if it catches the exception.

What action related to exceptions does a program take when it encounters invalid user input that might cause the program's behavior to be unreliable?

It throws an exception

Which ComboBox method fills the list from an array?

Items.AddRange

Which ComboBox method removes the item at index position 2?

Items.RemoveAt

Kayak Tour Scheduling Wizard: This application uses a software wizard to guide customers of the Kayaking Outfitter Company through the process of selecting one or more kayaking tours.

Kayak Tour Scheduling Wizard: A software wizard is an application that leads the user through a series of predescribed steps. In each step, the user may be given choices that influence subsequent steps. Wizards are particularly useful when completing tasks that are complicated or need to be completed in a specific sequence.

Which TextBox event fires each time the user presses a keyboard key?

Keypress

Exception Handling: When a Try block contains multiple statements (and it usually does), not all statements in the block may be able to execute.

Listbox, ComboBox, and CheckedListBox: ListBox, ComboBox, and CheckedListBox are collectively known as list-type controls.

Listbox, ComboBox, and CheckedListBox: The CheckedBoxList control has the same properties and behavior as a ListBox, except with added check boxes next to each item.

Listbox, ComboBox, and CheckedListBox: The CheckedListBox, CheckedIndices property contains a collection of the indexes of the checked items. Similarly, the CheckedItems collection contains the items that were checked.

Listbox, ComboBox, and CheckedListBox: The SelectedIndex property returns the index position of the most recently selected item of a list-type control. The SelectedItem property returns the item selected by the user.

Listbox, ComboBox, and CheckedListBox: The SelectedMode property of a ListBox can be configured to allow the user to make multiple selections.

Listbox, ComboBox, and CheckedListBox: The SelectedItems collection contains all selected items. The SelectedIndices collection contains the indexes of all selected items.

Listbox, ComboBox, and CheckedListBox: You can define a class and insert instances of the class into the Items collection of a list-type control.

Which DateTimePicker properties limit the earliest and latest date and time the user can select?

MinDateTime and MaxDateTime

Structured Exception Handling

One part of a program detects and responds to specific exceptions. When an exception is thrown, the program may be able to recover from the exception and continue executing, or it may close in a controlled manner.

TabControl Control

Provides a convenient way for you to divide a form into separate pages.

ErrorProvider Control

Provides a visual cue to the validation status of input fields on a form. It displays a bright red icon next to fields that have been found to contain invalid data.

DateTimePicker Control

Provides an attractive and intuitive way to display and ask for date information from the user. You can use it to display either a date or a time, depending on how it is configured.

Which property of a ListBox contains the indexes of all the selected items?

SelectedIndices

Which ListBox property controls the way multiple items are selected?

SelectionMode

Which ListBox property must be modified to permit the user to select multiple items?

SelectionMode

Which ErrorProvider method must be called to create a pop-up error message for a particular control?

SetError

Throwing An Exception

Some part of the program used the Throw statement to signal that it detected an error.

Which control can be used to divide the display area into two parts and allows the user to change the sizes of the two parts at runtime?

SplitContainer

Which control lets the user drag a vertical or horizontal bar between two panels?

SplitContainer Control

Which exception property returns a string containing the sequence of method calls that led up to the exception being thrown?

StackTrace

Try Block

Starts with Try and ends just before the Catch keyword. The Try block contains code that might cause an exception to be thrown.

Catch Block

Starts with the Catch keyword and ends before the Finally keyword or at the beginning of a new Catch block. The code in the Catch block executes when an exception is thrown. The Catch block is known as the exception handler.

Which control automatically docks at the bottom of a form and often contains a Label control?

StatusStrip

Which control lets you divide a form into separate pages?

TabControl

Which event handler is created when you double-click a TextBox control in design mode?

TextChanged

Leave

The leave event is fired when the user moves the focus away from any type of input control.

If you insert your own type of objects in a ListBox, which method in your class must be implemented?

ToString

Which Char method converts a character to uppercase?

ToUpper

Why types of buttons can be added to a ToolStrip control?

ToolStripButton, ToolStripSplitButton, and ToolStripDropDownButton

Which type of tool strip button displays a dropdown list when the button is clicked?

ToolStripDropDownButton

(T/F) A Catch block does not have to declare an exception variable.

True

(T/F) A Char data type holds a 16-bit Unicode character.

True

(T/F) An uncaught exception always causes an application to stop.

True

(T/F) Catch blocks should be sequenced so the most specific types of exceptions occur first, followed by more general exception types.

True

(T/F) If an exception is thrown inside a Try block, all statements in the Finally block execute anyway.

True

(T/F) If an exception is thrown midway through a Try block, the appropriate Catch block executes immediately.

True

(T/F) The Finally block always executes, whether or not an exception was thrown.

True

(T/F) The Finally block is optional.

True

(T/F) The IsDigit method is a shared method in the Char class.

True

(T/F) The Items.Remove method of a ListBox receives an integer index parameter.

True

(T/F) You cannot directly add a DateTime object to another DateTime object.

True

What type of exception causes a program to halt?

Unhandled Exception

What do we call an exception that is never caught?

Unhandled, or uncaught exception.

WebBrowser Control

Used to view online Web pages or HTML documents on a local computer.

RichTextBox Control

Where the user can write his or her notes and comments.

Does the code in a Finally block execute regardless of whether an exception was thrown?

Yes


Set pelajaran terkait

OB PrepU Exam 1 (Ch. 4-12, 19, 20.)

View Set

E-Commerce Chapter 5, E-Commerce Chapter 5 MCQ, Final Exam Ch 5, Ecommerce chapter 5 quiz 1, Ecommerce Ch 5, WK 3 - CH5, chapter 5 e-commerce, 660 MT - Chp 5, E-Commerce Chapter 5 T/F

View Set

Chapter 10 Pretrial / Criminal Trail

View Set

Chapter 11 Multiple Choice Questions

View Set

AST101 - Chapter 11: The Giant Planets

View Set