Structured Exception Handling

Since structured exception handling is used to resolve exceptions, a good starting point is to discuss what an exception is and what happens when an exception occurs. Structured exception handling then is compared with an alternative, appropriately named unstructured exception handling. Finally, the syntax of implementing structured exception handling is covered, followed by a project to illustrate structured exception handling in action. An exception may be defined as a problem that occurs...

Running to the Cursor

You also can right-click a line of code in the source window and choose Run To Cursor from the context menu shown in Figure 12-12. Your application starts up and runs until it reaches the cursor location (or an earlier breakpoint if there is one). J< 'r ' ,- ' fM t1* > 01 ii* H* JP- 3-X H 9 A ie - -'-> Rlkif r * 1 Vfc. I In IUbi L I i> lit i f l.E Efa LKukriI far-31 .Ttfal rr rli-LIH 3V3T & LlI Lb hj L 7jJ. jiuii'. l-i i t . _ IriHlB .m L H I I 'CMI Figure 12-12 The context menu for...

Module 7 Control Structures

The IIf function most closely resembles which of the If statements B. If. Then Else 2. Which of the If statements may concern the most alternatives D. If.ElseIf 3. Which statement may be done with a single line of code 4. Which can you have more than one of in an If statement D. ElseIf 5. You would use the CheckBox instead of the RadioButton control for an If ElseIf Else statem ent. 6. What control enables you to have more than one group of radio buttons on a form 7. What is the fundamental...

The IfElself Statement

You use the If.ElseIf statement if you have more than two alternative blocks of code, the maximum possible with an If Then Else statement. With an If.ElseIf statement, the first block of code whose condition is True executes, and all following blocks of code are skipped. The first block of code follows the If clause, and each succeeding block of code coupled with a condition is an ElseIf clause. You can have as many ElseIf clauses as you want. Finally, you may optionally have an Else clause,...

Floating Point Types

Table 4-5 lists the floating point data types, which represent numbers with both integer and fractional parts. All of the floating point numeric data types are signed. Table 4-5 lists the floating point data types, which represent numbers with both integer and fractional parts. All of the floating point numeric data types are signed. Table 4-5 Floating Point Data Types 79,228,162,514,264,337,59 3,543,950, 7.9228162514264337593543950335 with 28 places to the right of the decimal smallest...

Module 3 Event Procedures Properties and Controls

An event procedure connects an event to the code you want to run when the event occurs. 2. If you did not write an event procedure, nothing happens when an event occurs. False. If you did not write an event procedure, the event is handled by default, which may or may not result in an acti on visible to you. 3. What are inside the parentheses of an event procedure C. Parameters 4. You can change the name of the event in an event procedure stub. False 5. When you misspell code, such as...

Resizing an Array

You need to specify the size of an array before you can use it so memory is allocated for all elements of the array. However, Visual Basic .NET permits you to resize the array as necessary. This helps you manage memory efficiently. For example, you can use a large array for a short time and then change it to a smaller size, freeing up memory you no longer need. You have two alternative methods of resizing an array. The first is to assign a different array object to the same array variable using...

Access Specifiers

The available access specifiers, and their effect, depend on whether the variable is local or module level. If you declare a variable inside an event procedure, you would use the access specifier Dim or Static. The scope of a variable is identical under Dim or Static since you are declaring the variable inside an event procedure, you will not be able to access the variable outside the event procedure. Instead, the difference between Dim and Static concerns the lifetime of the variable. To...

Adding Functionality to the Toolbar

You added functionality to both MainMenu and ContextMenu items by using their Click event procedure. The process for adding functionality to a toolbar is somewhat different. You cannot create an event procedure for the individual toolbar buttons the same way you can for the individual menu items. Instead, you use the event procedure for the ToolBar itself, and the event is not the Click event, but the ButtonClick event. The event procedure title for the toolbar's ButtonClick event is Private...

Viewing and Changing Properties

You often will need to determine the existing value of an object's property or change the value of that property. In programming parlance, you read a property to determine its value, and you write to a property to change its value. You would read the Text property to obtain the title of a form, and you would write to the Text property to change the title of the form from, for example, Form1 to Godzilla. You can both read and write to most properties. However, some properties are readonly . This...

Setting a Breakpoint

You may set a breakpoint at a particular place of your choosing in your code. The breakpoint causes the debugger to place your program in break mode when the line of code marked by the breakpoint is reached in the execution of your program. Breakpoints enable you to suspend execution where and when you need to, rather than having to wade line by line through your code until you get to the desired point. Breakpoints therefore greatly speed up the debugging process. This is especially important...

Module 1 What Is Visual Basic NET

What is the basic purpose of a programming language The basic purpose of a programming language is to give instructions to a computer, which then executes those instructions. 2. This type of application is event-driven 6. ShowDialog, used by a FileDialog object to display itself, is 7. You link the running of code with a user action by associating the code with A class is a template that defines and describes an object and its properties, methods, and events. 9. Creating an object from a...

The Quick Watch Dialog

You use the QuickWatch dialog box to, as its name implies, quickly evaluate a variable or expression. Figure 12-20 shows a QuickWatch dialog box. Figure 12-20 The QuickWatch dialog box The QuickWatch dialog box is an alternative to the Watch window. The QuickWatch dialog box provides a quicker, simpler way of evaluating or editing a single variable or expression than does the Watch window. However, QuickWatch is a modal dialog box, so unlike the Watch window, you cannot leave the QuickWatch...

Visual Basic NETA Beginners Guide

McGraw-Hill Osborne 2600 Tenth Street Berkeley, California 94710 U.S.A. To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please contact McGraw-Hill Osborne at the above address. For information on translations or book distributors outside the U.S.A., please see the International Contact Information page immediately following the index of this book. Copyright 2002 by The McGraw-Hill Companies. All rights reserved. Printed in the United States of America. Except...

RadAdd

These controls correspond to the four arithmetic operators to be used in this Calculator project. To have one radio button start out checked, set the Checked property of radAdd to True. The Checked property of the other radio buttons automatically will be False, since only one radio button per group can be chosen at a time. 4. Add two TextBox controls, named txtOperand1 and txtOperand2, and set their Text properties to an empty string . Set the MaxLength property used in the Tuition project of...

Minute Drill

Overloaded procedures must differ from each other in what respect Overloaded procedures must differ from each other in respect to their argument list. In Module 7 we wrote a Calculator application. That project performs basic arithmetic addition, subtraction, multiplication, and division. The user inputs the two operands and chooses an operator by clicking a radio button corresponding to the operator. The application, befo re performing the arithmetic calculation, confirms that the user...

Radio Button Control

RadioButton controls also are commonly used in Windows applications. Taking again the example of the Print dialog box, there are radio buttons for Print to all pages, current page, or selected pages. The primary difference between CheckBox and RadioButton controls is that while each check box is independent, all radio buttons in a group are related in that only one of them can be chosen at any one time. Therefore, the RadioButton control is ideal for situations in which there are more than two...

Module 6 Comparison and Logical Operators

What data type do the comparison operators return 2. Which data type does the Like comparison operator compare D. String 3. Which comparison operator compares references to objects C. Is 4. Which statement affects whether a string comparison is case sensitive 5. Which of the following is not used in pattern matching in string comparisons 6. Comparison operations rank, in precedence B. Lower than arithmetic operators but higher than logical operators 7. Which of the following logical...