Download as pdf or txt
Download as pdf or txt
You are on page 1of 66

O F F I C I A L M I CRO S O F T L EA RN I N G PRO DU C T

2559B
Introduction to Visual Basic .NET
Programming with Microsoft .NET
Companion Content
Information in this document, including URL and other Internet Web site references, is subject to change
without notice. Unless otherwise noted, the example companies, organizations, products, domain names,
e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with
any real company, organization, product, domain name, e-mail address, logo, person, place or event is
intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the
user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in
or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property
rights covering subject matter in this document. Except as expressly provided in any written license
agreement from Microsoft, the furnishing of this document does not give you any license to these
patents, trademarks, copyrights, or other intellectual property.
The names of manufacturers, products, or URLs are provided for informational purposes only and
Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding
these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a
manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links
may be provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not
responsible for the contents of any linked site or any link contained in a linked site, or any changes or
updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission
received from any linked site. Microsoft is providing these links to you only as a convenience, and the
inclusion of any link does not imply endorsement of Microsoft of the site or the products contained
therein.
2002 Microsoft Corporation. All rights reserved.
Microsoft and the trademarks listed at
http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademarks/EN-US.aspx are trademarks
of the Microsoft group of companies. All other marks are property oftheir respective owners.

Product Number: 2559B


Released: 07/2002
Getting Started 1-1

Module 1
Getting Started
Contents:
Question and Answers 2
Multimedia 4
1-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Working in the Development Environment
Examine a form in the Windows Forms Designer and the Code Editor
1. What In Solution Explorer, right-click Form1.vb, and then click View Designer. Answer the
following questions:
a. What happens?
Answer: Form1.vb[Design] opens.
b. Is the Start Page still available?
Answer: Yes, because the Start Page tab is still visible.
2. Right-click anywhere on the form (except the title bar), and then click View Code to switch to the
Code Editor. (Note that View Code is also available from the shortcut menu for Form1.vb in
Solution Explorer.)
3. In the space below, write the names of the event handlers displayed in the Code Editor.
Private Sub ___________________ & Private Sub ___________________
Answer: Button1_Click & Button2_Click
4. Click the Form1.vb[Design] tab to return to Design view.

Using the Toolbox


Open, close, reopen, and hide the Toolbox
1. Point to the Toolbox icon on the left edge of the environment window. The Toolbox will open.
2. Click the pushpin icon in the Toolbox title bar. What happens?

Answer: The Toolbox is docked, and it stays open.


3. Close the Toolbox.
4. To reopen the Toolbox, on the View menu, click Toolbox.
Note that the pushpin icon has changed. Click the pushpin icon in the Toolbox title bar again.
What happens?
Answer: The Toolbox Auto Hide setting turns on.

Tip If you accidentally click a control, simply press ESC twice.

Examining properties
Examine property settings for controls
1. In Design view, click Button1. Examine the settings for the Name and TabIndex properties.

2. Click on the form anywhere but on a control. What happens in the Properties window?
Answer: The properties of the form appear in the Properties windows.
3. Examine the Name and BackgroundImage properties of the form.
Getting Started 1-3

Using Help
Use the Dynamic Help window
1. Verify that Form1.vb is displayed in the design window. Click the form, click Button1, and then
click the BackColor property for Button1.
2. Click the Dynamic Help tab at the bottom of the Properties window. If the tab is not visible, on the
Help menu, click Dynamic Help.
Notice that the suggested articles are related to the items selected in the Properties window.
3. From the list of articles under the Help heading, click Properties Window and view the related
Help topic.
4. On the Help menu, click Contents.
5. In the Contents window, click Visual Basic and Related in the Filtered by box.
6. Click the Sync Contents button on the toolbar to view this topic's location in the Help
contents.
7. Quit Visual Studio .NET.

Review Answers
1. How do you open the Code Editor for a form? Give an example of why you would want to do so.
Answer: In Solution Explorer, click the View Code button on the toolbar. You need to open
the Code Editor to write code that adds functionality to a control event.
2. How can the common language runtime manage execution for applications written in many
different programming languages?
Answer: Visual Studio .NET compiles all code regardless of the programming language into
a common language: Microsoft intermediate language (MSIL).
3. After you create the design specification for your application, how do you create the user interface
objects?
Answer: Add controls from the Toolbox to the Windows Forms Designer.
4. While you are creating an application in Visual Basic .NET, how can you ensure that it is working
correctly after you make a major change?
Answer: On the standard toolbar, click the Start button to run the application inside the
development environment. If errors are encountered, the application will stop running and
the compiler will display an error message to help you find and fix the problem.
5. What programming tool do you use to change the color and caption of a user interface object?
Answer: The Properties window or the Code Editor.
6. When should you create a release build of your application?
Answer: When you are ready to test and distribute the application to other users or
computers.
1-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

Multimedia
Media Type Title

Demonstration Tour of Visual Studio .NET


Working with Forms and Controls 2-1

Module 2
Working with Forms and Controls
Contents:
Question and Answers 2
Multimedia 4
Lab: Question and Answers 5
2-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Properties, Methods, and Events
For each of the following objects, suggest associated properties, methods, and events.
Answer:

Object Properties Methods Events

Example: Width, Color, Volume Ring, VolumeChange VolumeChanged,


Telephone DialCompleted (in
response to a user
dialing)

Door Height, Width, Open, Lock Closing, Opened


Material

Car Color, Model, Year Stop, KeyTurn BrakePedalPushed,


KeyTurned

Review Answers
1. What is the relationship between classes and objects?
Answer: Classes are the symbolic representation of objects. Every object is an instance of a
class.
2. Identify each of the following elements as a property, method, or event.

a. Click e. Size

b. Close f. Resize

c. Text g. Show

d. KeyPress h. Closing

Answer:
Elements a, d, f, and h are events.
Elements b and g are methods.
Elements c and e are properties.
3. You are creating a new application and change the properties for Form1, as listed in the table
below. When you try to run the application, you get an error message notifying you of build errors.
What is the probable cause of this error, and how can you fix it?

Form property New value

ControlBox False

Name LogonForm

Text Logon Form


Working with Forms and Controls 2-3

StartPosition CenterScreen

Answer: You might be getting an error message because the startup object is still listed as
Form1. When you change the Name property of the form, you must change the startup
object for the project. To do this, right-click the project in Solution Explorer, click
Properties, and then set LogonForm as the new startup object.

4. Evaluate whether each of the following statements is true or false. For any false statement, explain
why it is false.
a. When you call the Hide method of a form, the form closes.
b. You use the following syntax to display a form:
FormName.Show( )
c. You should give users maximum control by minimizing the modal interactions in your
applications.
Answer:
a. False. When you call the Hide method of a form, the form becomes invisible but it
does not close.
b. True.
c. True.

5. You are writing a program and need to place the contents of the FirstNameTextBox into a
message box. Write the code that would create this message box.
Answer:

MessageBox.Show(FirstNameTextBox.Text)

6. The following code is listed in the Code Editor for Form1, which has one button named
ClickMeButton. Add a comment to this code that explains what it does. Be sure to use the correct
character for indicating a comment.

Private Sub ClickMeButton_Click(...)


Me.CenterToScreen( )
MessageBox.Show("Hi")
End Sub

Answer:

' Centers Form1 on the screen and then opens a message box
2-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

Multimedia
Media Type Title

Animation What are Objects, Properties, Methods, and Events?

Demonstration Managing Forms

Demonstration Form and Control Events


Working with Forms and Controls 2-5

Lab: Question and Answers


Lab 2.1
Exercise 1: Creating the Main Form
Add controls to the main form
1. Add two Label controls to the form.
2. Add one TextBox control to the form.
3. Add one ComboBox control to the form.
4. Add a GroupBox control to the form, and then add three RadioButton controls inside the
GroupBox control.
5. Add a Button control to the form.

Your form should look similar to the following screen shot.

6. Set the properties for the controls as listed in the following table.

Control name Property Property value

Label1 Name LoanLabel

Text Loan Amount

Label2 Name RateLabel

Text Interest Rate

TextBox1 Name LoanTextBox

Text blank

ComboBox1 Name RateComboBox


2-6 Introduction to Visual Basic .NET Programming with Microsoft .NET

Text blank

Items 4.5
6.25
7.0
8.325
9.0
10.0

GroupBox1 Name TermGroupBox

Text Loan Term

RadioButton1 Name Length5RadioButton

Text 5 Years

Checked True

RadioButton2 Name Length15RadioButton

Text 15 Years

RadioButton3 Name Length30RadioButton

Text 30 Years

Button1 Name DoneButton

Text &Done

Form1 Name MainForm

Text Loan Payment Estimate

FormBorderStyle FixedSingle

MaximizeBox False

CancelButton DoneButton

Your form should now look similar to the following screen shot.
Working with Forms and Controls 2-7

Test the application


1. On the Debug menu, click Start. Type a loan amount and select an interest rate.
2. Click the Done button to quit the application.
3. Run the application again.
4. Press ESC.
What happens? Why?
Answer: The application quits because the Done button is specified in the CancelButton
property of the form.
Using Variables and Arrays 3-1

Module 3
Using Variables and Arrays
Contents:
Question and Answers 2
Multimedia 5
3-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Choosing Data Types
Introduction
Work in pairs to analyze the example data and choose the appropriate data type.
Instructions
Choose the most compact data type for each of the following examples of data:
Street address
Answer: String.

Loan amount
Answer: Decimal. Use the Decimal type for currency because Decimals are not rounded off.
Singles and Doublescan be rounded off.
Phone number
Answer: String.
Interest rate
Answer: Single.
Birthday
Answer: Date.
Personal identification number
Answer: String: When business rules require mixed alphabetical and numeric characters.
Integer, Short, or Long (smallest appropriate numeric data type): When no alphabetic
characters are needed.

Practice: Find the Bugs


Instructions
Rewrite the following declaration statements to fix the errors. Follow the naming rules and
recommendations for local variables.

Dim 12Count As Integer


Dim Number For Double
Const Son's Birthday As Day
Dim Error.Message As Text
Dim $CurrentExpenses With Decimal

Answer:

Dim count As Integer


Dim number As Double
Const SonBirthday As Date
Dim errorMessage As String
Dim currentExpenses As Decimal
Using Variables and Arrays 3-3

Review Answers
1. Which Visual Basic .NET data type do you use to store True or False values?
Answer: Boolean.
2. Declare a local variable called myDayOff, and assign to it a value of 12/25/2001. Write this code in
two different ways.

Answer:

Dim myDayOff As Date


myDayOff = #12/25/2001#

- or -

Dim myDayOff As Date = #12/25/2001#

3. Review the following code.

Public Class BankAccount


. . .
Public MyVariable As Integer
. . .
End Class

a. What is the scope level of MyVariable?


Answer: All code in the solution has unrestricted access to MyVariable.
b. How can you rewrite the code so that MyVariable can only be accessed from within the project
in which it is declared?
Answer: Change the access modifier from Public to Friend and ensure that it is declared
at the module level.
4. True or false: the value of a local variable is preserved between multiple procedure calls unless you
explicitly destroy the instance of the variable.
Answer: False. Local variables only exist as long as the block or procedure in which they are
called is running.
5. What is the value and data type of myInteger after the following code runs?

Dim myInteger As Integer


Dim myDouble As Double
myInteger = 5555
myDouble = CDbl(myInteger)

Answer: The value of myInteger is set to 5555, and myDouble receives the value of
myInteger after it is converted from Integer to Double. The data type remains the same.
6. First, create a public structure named CustomerInfo with the following data members:
A FirstName variable that is accessible anywhere in the solution

A LastName variable that is accessible anywhere in the solution

An AccountNumber variable that is accessible anywhere in the project

A HomePhone variable that is accessible anywhere in the structure


3-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

Second, declare a FirstCustomer variable of type CustomerInfo.

Answer

Public Structure CustomerInfo


Public FirstName As String
Public LastName As String
Friend AccountNumber As Integer
Private HomePhone As Long
End Structure

Dim FirstCustomer As CustomerInfo

7. Write the code to assign a value of 100 to the fourth element in the second column of the
following array. What is the total number of elements in the array?

Dim testArray(8,8) As Integer

Answer:

testArray(3,1) = 100

The total number of elements in the array is 81.


Using Variables and Arrays 3-5

Multimedia
Media Type Title

Animation What are Variables?

Demonstration How to Set Access Levels for Variables


Working with Procedures 4-1

Module 4
Working with Procedures
Contents:
Question and Answers 2
Multimedia 5
4-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Examining Predefined Functions
Use the content of the library
Use the "Visual Basic Run-Time Library Members" document and the linked documents to answer the
questions in the following list. To navigate back to the "Visual Basic Run-Time Library Members"
document from other documents, you can use the Web Navigate Back button on the toolbar.
1. How is the content in the "Visual Basic Run-Time Library Members" document organized?
Answer: The content is grouped according to categories of functionality.
2. What is the purpose of the InStr function?
Answer: The InStr function returns an integer that specifies the start position of the first
occurrence of one string within another.
3. What value will the InStr function return if it cannot locate the second string?
Answer: The function will return 0.
4. What are the parameters of the Mid function? Note whether the parameters are required or
optional.
Answer: The Mid function takes two required parameters-Str and Start-and an optional
parameter-Length.
5. Based on your answer to the previous question, what value would you expect the following code to
assign to the myAnswer and secondAnswer variables?

Dim myString, myAnswer, secondAnswer As String


myString = "Using Mid Function"
myAnswer = Mid(myString, 7, 3)
secondAnswer = Mid(myString, 7)

Answer: The value returned for myAnswer is "Mid".


The value returned for secondAnswer is "Mid Function".
6. In the line after the following code, add code that uses the Right function to return the string
"Doe" from the string "John Doe".

Dim myString As String = "John Doe"


Dim subString As String

Answer:

subString = Microsoft.VisualBasic.Right(myString, 3)

7. Is Now a predefined function?


Answer: No. Now is a public property of the DateTime structure in the System namespace.
8. List four topics that the Visual Basic Language Reference provides as links related to the reference
topic that describes Now.
Answer: There are 13 topics listed in the See Also section at the bottom of the Now Property
topic. These topics include Day Function, Hour Function, Month Function, and Today
Property.
Working with Procedures 4-3

Review Answers
1. Explain the default values in Visual Basic .NET for the following elements:
a. Accessibility for a procedure written in a module
b. Passing mechanism for passing arguments to procedures
c. Accessibility for a module

Answer:
a. Public. This means that there are no restrictions to access.
b. ByVal. This means that a copy of the data is passed to the called procedure. The
called procedure cannot change the original value of the data.
c. Friend. This means that the module is accessible within the program that contains
the module declaration.

2. Given the following code, what value would the message box in the Sub Test procedure display?
Why?

Sub Count(ByRef number As Integer)


number = number + 1
End Sub

Sub Test( )
Dim myNumber As Integer = 10
Count(myNumber)
MessageBox.Show(myNumber)
End Sub

Answer: The message box would display 11. This is because the variable is passed to the Sub
Count procedure by reference, which allows Sub Count to modify the original value of the
variable.
3. Which of the following code statements calls the CheckPassword function and passes the contents
of the Password text box?
a. myAnswer = CheckPassword.Text(Password)
b. Password.Text(CheckPassword)
c. CheckPassword( ) = Password.Text
d. myAnswer = CheckPassword(Password.Text)
Answer:

d. myAnswer = CheckPassword(Password.Text)

4. Describe one of the predefined date and time functions provided by Visual Basic .NET, and give an
example of when you might use it.
Answer: The DateAdd function adds or subtracts a specific time interval to or from a date.
Example: You could use DateAdd to calculate the due date for a bill if you had the bill date
and the number of days between the bill date and the date on which the bill is due.
4-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

The DateDiff function determines how many specified time intervals exist between two
date/time values. Example: You could use DateDiff to calculate the number of days between
today and the end of the year.
Working with Procedures 4-5

Multimedia
Media Type Title

Demonstration Writing Reusable Code

Animation Passing Arguments


Decision Structures and Loops 5-1

Module 5
Decision Structures and Loops
Contents:
Question and Answers 2
4-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Evaluating Conditional Expressions
Run the application
1. On the standardtoolbar, click the Start button.
2. Calculate the answer to the expressions listed in the following table and use the application to
check your calculations.
a. To check the following expressions, pass the values as String values by leaving the Treat
Values As Numeric check box clear.
Answer:

Expression Result (Write result from application below.)

TestString = TestString True (-1)

TestString = Teststring False (0)

TestString < TestString False (0)

Test < TestString True (-1)

b. To check the following expressions, pass the values as Numeric values by selecting Treat
Values As Numeric. In the expressions that use logical operators, remember that -1
evaluates to True and 0 evaluates to False.
Answer:

Expression Result (Write result from application below.)

100 > 10 True (-1)

10 < 10 False (0)

10 <= 10 True (-1)

0 And 0 False (0)

-1 And 0 False (0)

-1 And -1 True (-1)

-1 Or -1 True (-1)

-1 Xor -1 False (0)

-1 Xor 0 True (-1)

0 Xor 0 False (0)


Decision Structures and Loops 5-3

Practice: Designing Loop Structures


Scenario 1
You have created a cash register application that stores the price of each item purchased in an array.
When the user has finished purchasing items, the code needs to search the array and calculate the total of
all items purchased. The size of the array will vary with the number of items purchased.
Which loop structure would be best suited to solve this problem?
Answer: For EachNext.
A For EachNext statement would move through all array elements, providing each array element
in the For Each variable.

Scenario 2
Your application contains the mathematical equation y = x+3. The application needs to calculate the
result of this equation for values of x in the range -100 to 100 in steps of 10.
Which loop structure would be best suited to solve this problem?
Answer: ForNext.

For x = -100 To 100 Step 10


Next

This problem could also be solved with a Loop UntilDo statement and an incremented variable,
but a ForNext statement is more readable.

Scenario 3
Your application takes the content of a log file on a computer's hard disk and displays this data in a text
box on a form. The program sequentially reads the lines of data held in the log file. The number of lines of
data held in the file is unknown, but you do have a function called EOF that returns True when the end of
the file is reached.
Which loop structure would be best suited to solve this problem?
Answer: Do UntilLoop.
Because the number of lines contained in the file is unknown, a Do Until...Loop statement is ideal,
especially because in this case an expression to determine whether the end of the file has been
reached is available.

FileOpen(1, "C:\file.log", OpenMode.Input)


Do Until EOF(1)
TextBox1.Text=TextBox1.Text & Chr(13) & Chr(10) & _
LineInput(1)
Loop
FileClose(1)

Scenario 4
Your application uses a City object to determine sales discount values on various retail items, depending
on the city from which the items are purchased. You want to display the discounts associated with each
city in a list box.
Which loop structure would be best suited to solve this problem?
Answer: For EachNext.
4-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

For Each City in CityCollection


ListBox.Items.Add(City.Discount)
Next

Use a For...Next statement


In this section of the practice, you will open a new project and use a For...Next statement to create a
multiplication table on a form.
1. Open a new project in Visual Basic .NET. Use the Microsoft Windows Application template. Set the
project name to MultiplicationTable and the location to
install_folder\Practices\Mod05\MultiplicationTable.
2. Add a label to the form, and resize the label so that the width is 255 and the height is 190. Center
the label on the form.
3. Set the Font property of the label to Courier New.
4. Create an event handler for the Form1_Load event, and add the following code:

Dim outerLoop, innerLoop As Integer


Dim result As String
' Outer For...Next loop
For outerLoop = 1 To 10
' Inner For...Next loop
For innerLoop = 1 To 10
result = result & " " & (outerLoop * innerLoop)
Next innerLoop
result = result & vbCrLf
Next outerLoop
' Display result in the label
Label1.Text = result

5. Answer the following questions before running the application:


a. Which three lines of code define the inner loop?

Answer:

For innerLoop = 1 To 10
result = result & " " & (outerLoop * innerLoop)
Next innerLoop

b. What will the values of outerLoop and innerLoop be the second time the inner loop runs?
Answer: The value of outerLoop will be 1; the value of innerLoop will be 2.
c. What do you expect the result in the label to look like after the code runs?
Answer: The following illustration shows the content of the label in the running
application.
Decision Structures and Loops 5-5

6. Run the application to verify your answer to question 5.c.


A multiplication table will appear in the label on the form.
Solution files
The solution files for this practice are in the install_folder\Practices\ Mod05\MultiplicationTable\Solution
folder.

Review Answers
1. What is the result of the following conditional expression?
"TinyDog" > "BigCat"
Answer: The expression returns True because T is greater than B.
2. Write a decision statement to display a message box warning that the CPU is overheating if the
CPU temperature is 125 degrees or higher.
Answer:

If temp >= 125 Then


MessageBox.Show("The CPU is overheating.")
End If

3. What structure would be best for looping through a known number of questions?
Answer: The For...Next looping structure.
4. What value should x contain for the following loop to end?

Do While x = True
MessageBox.Show("Hello")
' Code to change the value of x
Loop

Answer: False
5. The OceanName variable will contain either Atlantic, Pacific, Indian, or Arctic. Your code needs to
assign a number ranging from 1 to 4, respectively, to the OceanNumber variable. If a name that is
not one of these four choices is identified, the code should return a message box that identifies that
there is an error. Write code to perform this functionality.
Answer:

Select Case OceanName


4-6 Introduction to Visual Basic .NET Programming with Microsoft .NET

Case "Atlantic"
OceanNumber = 1
Case "Pacific"
OceanNumber = 2
Case "Indian"
OceanNumber = 3
Case "Arctic"
OceanNumber = 4
Case Else
MessageBox.Show("Invalid Ocean name!")
End Select
Validating User Input 6-1

Module 6
Validating User Input
Contents:
Question and Answers 2
Multimedia 3
6-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Review Answers
1. How do you make a TextBox read-only?
Answer: In the Properties window, set the ReadOnly property to True.
2. What occurs when a user enters an invalid character in a Masked Edit control?
Answer: The computer beeps if sound is enabled. The invalid character is not accepted and
the application continues.
3. How can you use intrinsic validation to restrict data entry to dates and times?
Answer: Use the DateTimePicker control.
4. What happens when a user enters data in a TextBox in which the PasswordChar property is set to
* (asterisk)?
Answer: No matter what characters the user enters, they are displayed as asterisks. This
technique is often used to hide passwords in logon dialog boxes.
5. Write the code to call the SetError method of ErrorProvider1 for TextBox1 and display the message
"Please enter your first name."
Answer:

ErrorProvider1.SetError(TextBox1, "Please enter your " & _


"first name.")

6. What technique can you use to provide a visual cue to the user when all required fields on a form
have been filled in?
Answer: Add an OK button to the form, and enable it only after the user has entered data in
all required fields.
7. If you want to provide validation feedback after the user has entered data in all required fields,
where should you put your validation code?
Answer: In the Click event handler for the OK button or other designated accept button.
Validating User Input 6-3

Multimedia
Media Type Title

Animation Validating User Input


Object-Oriented Programming in Visual Basic .NET 7-1

Module 7
Object-Oriented Programming in Visual Basic .NET
Contents:
Question and Answers 2
Multimedia 3
7-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Review Answers
1. In designing a direct deposit application, developers analyze all the relevant objects and disregard
all the irrelevant objects. What is this process called?
Answer: Abstraction.
2. In a direct deposit application, the inner workings and implementation are hidden from the user.
What is this process called?
Answer: Encapsulation.
3. Write the code to create a public class called Student that hasa private instance data member
named testScore of type Integer.
Answer:

Public Class Student


Private testScore As Integer
End Class

4. Write code to add a read-only property called Score to the Student class.
Answer:

Public Class Student


Private testScore As Integer
Public ReadOnly Property Score( ) As Integer
Get
Return testScore
End Get
End Property
End Class

5. Explain what Sub New and Sub Finalize do.


Answer: Sub New is a constructor that is used to control the initialization of new objects.
Sub Finalize is a destructor that is used to control what happens during the destruction of
objects.
6. Can you inherit from multiple classes in Visual Basic .NET?

Answer: No. Visual Basic .NET supports single inheritance at the class level.
Object-Oriented Programming in Visual Basic .NET 7-3

Multimedia
Media Type Title

Animation Introduction to Object-Oriented Concepts


Handling Errors and Exceptions 8-1

Module 8
Handling Errors and Exceptions
Contents:
Question and Answers 2
Multimedia 6
Lab: Question and Answers 7
8-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Debugging Code
Open the project
Open the DebugApplication.sln project, which is in the install_folder\Practices\Mod08\Starter folder.
This application is designed to calculate the number of words in a sentence. The user types a sentence
into a text box on a form and clicks a button, and then a message box appears telling the user how many
words are in the sentence that was typed.

The following screen shot shows the running application.

Examine the NumberOfWords_Click event handler


Open the NumberOfWords_Click event handler, and examine the code to understand how the
application has been written to accomplish the expected functionality.
Answer the following questions about the code.
a. Notice the variable declarations. How will the sentence variable be assigned its value? What is the
purpose of the Trim function?
Answer: The string entered by the user into the InputTextBox will be assigned to the
sentence variable. The Trim function removes any spaces at the beginning and end of the
string.
b. Explain the code that initially assigns a value to location. Note that the term Chr(32) in the
constant declaration for spaceDelimeter refers to a space character.
Answer: The InStr function will search for a space character in the sentence string, starting
at the first character. If it finds a space character, it will assign the position of the
character to location. If it does not find a space character, the function will return a value
of 0.
c. What condition will prevent the While loop from iterating?
Answer: If there is no space character, the value of location will be 0. When the value of
location is 0, the code in the While block will not run. Code execution will continue to the
If...Then block.
d. What is the purpose of the wordCount variable?
Answer: The wordCount variable stores the total number of words in the sentence.
e. What is the purpose of assigning a new value to location in the While loop? Why does the
location assignment using the InStr function occur again?
Handling Errors and Exceptions 8-3

Answer: After each space is found, it is necessary to run a search for more spaces. This
code searches for additional occurrences of the space character beyond any occurrences
that have already been counted.

f. Describe the code flow that you would expect if a user were to type the word "Test" with no
spaces into InputTextBox. What value would the message box return?
Answer: Because there are no spaces in the user-entered text, the value of location will be
set to 0. The While loop will evaluate the value of location, and because the value is 0,
code execution will pass to the If...Then code block. The length of sentence is not equal to
0, so wordCount will be incremented from 0 to 1 in the If...Then block. The message box
will display the message "Total number of words 1."
g. Describe the code flow that you would expect if a user were to type the words "Test Me" into
InputTextBox. What value would the message box return?
Answer: Because there is a space at position 5 in the user-entered text, the value of
location will be set to 5. The While loop will evaluate the value of location and increment
wordCount from 0 to 1. Because there are no spaces in the remaining text, the value of
location will be reset to 0. The While loop will evaluate the new value of location, and
because the value is now 0, code execution will pass to the If...Then code block. The length
of sentence is not equal to 0, so wordCount will be incremented from 1 to 2 in the If...Then
block. The message box will show the message "Total number of words 2."

Note Check your answers before continuing to the next part of the practice. To check your answers,
you can use the answers provided on the Student Materials compact disc, compare answers with
another student, or show your answers to the instructor. To check your answers for the last two
questions, you can also set a breakpoint at the beginning of the While loop and use the Step Into
command (F11) to move through the code step by step.

Locate the code that causes the error


1. To locate the logic error in this application, think through the following questions:
a. What input from the user is causing this error?
Answer: The error occurs when a user types multiple space characters between two
consecutive words.
b. What debugging tools could you use to locate the code causing the error?
Answer: Possible answer: Set a breakpoint in the event handler, run the application, and
then use the Step Into command to step through the code one line at a time. Use the
Autos window to examine the variable values and determine when the error occurs.
2. In the NumberOfWords_Click event handler, on the line of code that starts the While Loop, set a
breakpoint.
3. Run the application. In the Enter a sentence box, type Test Me with extra spaces between the two
words, and then click the Total Words button.

4. Use the Step Into command (F11) to step through the code one line at a time. As you step through
the code, use the Autos window to examine the variable values and determine when the error
occurs.
You might want to use the following questions to help you locate the logic error:
8-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

a. What is the value of location during the first iteration of the While loop?
Answer: 5.
b. Does the value of wordCount increment properly after the first space is found?

Answer: Yes.
c. What is the value of location when the value of wordCount changes to 2?
Answer: 6.
d. How many words have actually been counted if the current value of location is 6?
Answer: One.
e. Describe the problem with this code, and suggest a way to correct the error.

Answer: The code in the While loop uses the presence of a space character within the
sentence string as an indication that there is a word that needs to be counted. This logic
does not account for the possible occurrence of two or more space characters between
two consecutive words. The following procedure describes one way to correct the error.

Review Answers
1. Explain the following terms:
a. Syntax error
b. Run-time error
c. Breakpoint
d. Call stack
Answer:
a. A syntax error is an error that occurs when you write code in a manner that is not
allowed by the rules of the language.
b. A run-time error is an error that occurs when a statement attempts an operation
that is impossible to carry out. Run-time errors appear after you compile and run
your code.
c. A breakpoint is a marker in your code that causes Visual Basic to pause code
execution at a specific line.
d. A call stack is the series of procedures called within an application.
2. Suppose you want to enter break mode only if a certain condition is true. How can you set this type
of breakpoint?
Answer: Use the Breakpoint Properties dialog box to set the Condition property of the
breakpoint.
3. Examine the following code. In what order will the statements in the Try...Catch...Finally block
execute in each of the following cases?
a. No exception occurs.
b. A FileNotFoundException occurs.
c. An IOException occurs.
Handling Errors and Exceptions 8-5

Try
fs = New FileStream("data.txt", FileMode.Open)
Catch ex As FileNotFoundException
MessageBox.Show("File not found")
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
If Not (fs Is Nothing) Then fs.Close( )
End Try

Answer:
a. The Try statement will execute, followed by the Finally statement.
b. The Try statement will execute, followed by the first Catch statement and the associated
message box, followed by the Finally statement.

c. The Try statement will execute, followed by the second Catch statement and the
associated message box, followed by the Finally statement.
4. Write a statement that throws an exception of type ArgumentOutOfRangeException if the
variable percent is less than zero or greater than 100.
Answer

If (percent < 0) Or (percent > 100) Then


Throw New ArgumentOutOfRangeException( )
End If

5. Why should structured exception handling not be used to handle an error that is likely to occur
routinely?

Answer: While having exception handling in your code does not affect performance if
exceptions are never thrown, the process of determining which Catch block will catch an
exception-in addition to executing all of the Finally blocks-can affect performance.
8-6 Introduction to Visual Basic .NET Programming with Microsoft .NET

Multimedia
Media Type Title

Demonstration How to Debug An Application


Handling Errors and Exceptions 8-7

Lab: Question and Answers


Lab 8.1
Exercise 1: Using Try...Catch Blocks
Build the application
On the Build menu, click Build Solution.
What happens?
Answer: The build fails because of syntax errors. This happens because the library that contains
the MessageBox class is not referenced in the project.

Fix the error


1. In Solution Explorer, right-click References and then click Add Reference. In the Add Reference
dialog box, on the .NET tab, click System.Windows.Forms.dll. Click Select, and then click OK.
2. After fixing the errors, build the application and run it in debug mode.
What happens when you run the application? Why?
Answer: The application stops responding because of an unhandled exception. The test.txt
file does not exist.
How would you handle the error?
Answer: Add structured exception handling to prevent the application from crashing when a
file does not exist.
3. Click Continue to quit the application.

Build the application


1. Run the application in debug mode.
What happens?

Answer: The application displays a message informing the user that the file was not found.
2. Click OK in the message box to quit the application.

Build and run the application


1. Build and run the application in debug mode.
What happens?
Answer: The application displays the line of text from the test.txt file in a message box.
2. Click OK in the message box to quit the application.

Build and test the application


1. Run the application in debug mode.
What happens? Why?
Answer: An incorrect error message-"File Not Found"-appears, because the order of the
Catch blocks is not correct. Catch blocks should be arranged from specific to general. In this
case, the first Catch block is the general one and therefore it catches all types of exceptions.
The second Catch block does not execute.
8-8 Introduction to Visual Basic .NET Programming with Microsoft .NET

How should you fix the error?


Answer: Move the Catch ex As Exceptionblock to the end of the Try...Catch block, change the
message shown by the general Catchblock, and add another Catch block to handle a
FileNotFoundException.
2. Click OK to quit the application.

Exercise 2: Using Try...Catch...Finally Blocks


Build and test the application
1. Run the application in debug mode.

What happens?
Answer: A message box displays a discount amount of $8.00.
2. Click OK in the message box to quit the application.

Build and test the application


1. Run the application in debug mode.
What happens?
Answer: A message box displays a message stating that a cast error has occurred.
2. Click OK in the message box to quit the application.

Debug the application


1. Set a breakpoint on the MessageBox.Show line of code.
2. Run the application in debug mode again.
Why did the application not enter break mode at the breakpoint?
Answer: The exception occurred before the MessageBox.Show line of code. When an
exception occurs on a line in a Try block, the remaining lines of code in the Try block are not
executed and the flow is transferred to the Catch block.
3. Click OK in the message box to quit the application.
4. Remove the breakpoint.
5. Place the insertion point on the Try line, and start the application by using the Run To Cursor
command.
6. Use the F11 key to step through your code.
Which line throws the exception? Why?
Answer: The CInt(reader.ReadLine( )) line throws an InvalidCastException error because the
data type conversion fails.
Does the code for closing the file and the reader execute after the exception occurs?
Answer: No.
How can you ensure that the code for closing the file and the reader is always executed?

Answer: Write the code for closing these resources in a Finally block.
7. Quit the application.
Handling Errors and Exceptions 8-9

Add a Finally block


1. Add a Finally block before the End Try statement.
2. In the Try block, delete the calls to the Close method.
3. In the Finally block, close the file and the reader objects. Your code should look similar to the
following code:

Finally
file.Close ( )
reader.Close ( )

4. Note that this code contains two syntax errors. What is causing the errors?
Answer: The file and the reader have only block-level scope because they are declared in the
Try block.
5. Declare the file and reader variables outside the Try block, and change the code inside the Try block
to create new instances of the FileStream and StreamReader classes and assign them to these
variables. Your code should look similar to the following code:

Sub Main

Dim file As FileStream


Dim reader As StreamReader

Try
file = New FileStream("input.txt", FileMode.Open)
reader = New StreamReader(file)
...
Catch ex as Exception
MessageBox.Show(ex.Message)

Finally
...

End Try

Test the application


1. Run the application in debug mode. In the message box that appears, click OK.
Why does an unhandled exception of type NullReferenceException occur?
Answer: This exception occurs because an attempt is made to call the Close method on a file
object that does not exist. The input file does not exist in the C:\ folder. Because this file does
not exist, the new instance of the FileStream class was not created.
2. Click Continue to quit the application.
3. In the Finally block, before calling the Close method, use the IsNothing function to check whether
the objects exist. Your code should look similar to the following code:

...
Finally
If Not IsNothing (reader) Then reader.Close( )
If Not IsNothing (file) Then file.Close( )
End Try
Enhancing the User Interface 9-1

Module 9
Enhancing the User Interface
Contents:
Question and Answers 2
Multimedia 3
9-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Review Answers
1. Explain the purpose of the following elements:
a. Access keys
b. Shortcut keys
c. ToolTips
Answer:
a. Access keys allow keyboard navigation of menus. Pressing ALT and the underlined
access key activates the desired menu or menu item.
b. Shortcut keys are keyboard commands used to access menu items in an
application.
c. ToolTips are used to provide help to a user when the user rests the mouse pointer
over a control.
2. Determine which of the following code statements changes the contents of the first panel of a
status bar named StatusBar1 to read "Press F1 for Help."
a. "Press F1 for Help." = StatusBar1.Panels(1).Text
b. StatusBar1.Panels(1).Text = "Press F1 for Help."
c. StatusBar1.Panel1.Text = "Press F1 for Help."
d. StatusBar1.Panels(0).Text = "Press F1 for Help."
Answer: d. StatusBar1.Panels(0).Text = "Press F1 for Help." Because the index for the
panels starts with 0, the first panel on StatusBar1 is referred to as
StatusBar1.Panels(0).
3. Which statement or statements correctly complete the following sentence?
Images for a toolbar's buttons are:
a. Assigned an index number in the Image Collection Editor.
b. Automatically attached to the toolbar button based on function.

c. Maintained in the ToolBarButton Image Collection Editor.


d. Maintained in a separate ImageList control.
Answer: Statements a and d correctly complete the sentence.
Enhancing the User Interface 9-3

Multimedia
Media Type Title

Demonstration How to Create Menus


Web Forms and XML Web Services 10-1

Module 10
Web Forms and XML Web Services
Contents:
Question and Answers 2
10-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Review Answers
1. How can you display text to the user on a Web Forms page?
a. In Design view, add a Label control to the Web Form and then type the text in the Text
property.
b. In Design view, in Flow layout mode, type the text directly onto the Web Form.
c. In Design view, in Grid layout mode, type the text directly onto the Web Form.
d. In HTML view, add the text, using the appropriate HTML tags.

Answer: Answers a, b, and d are correct.


2. Which of the following is the file extension for the file that contains the event-handling code for a
Web Form?
a. asmx
b. Web.config
c. webform1.vb
d. aspx.vb
Answer: Answer d is correct.
3. What attribute causes the server to recognize that an element is a server control?
Answer: runat = "server"
4. What is the default name for a Web server running on a local machine?
a. aspx
b. localhost
c. localserver
d. aspx.vb
Answer: Answer b is correct.
5. What is the protocol that is used to communicate between a proxy and an XML Web service?
a. HTML
b. WSDL
c. SOAP
d. UDDI
Answer: Answer c is correct.
6. How do you access an XML Web service from a Web Form?
Answer: You create a Web reference to the XML Web service. Creating this reference causes
Visual Studio to create a proxy. In an event procedure on the Web Form, instantiate the
proxy and call the Web methods of the XML Web service.
Using ADO.NET 11-1

Module 11
Using ADO.NET
Contents:
Question and Answers 2
11-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Practice: Identifying Connected or Disconnected Data Scenarios
Introduction
In this practice, you will work with a partner to discuss five scenarios and determine whether they would
be best implemented in a connected or disconnected scenario. You will also determine whether the
scenario requires read-only or read/write access.

Instructions
1. Analyze each scenario.
2. Choose a connected or disconnected environment, depending on the application requirements.
3. Determine whether read-only or read/write data access is required.

Scenario 1
An investment-banking firm needs a system that will allow customers to use the Internet to track their
own portfolios. The firm needs to provide services such as historical charts, account history, individual
transaction details, and limited investment analysis.
Answer: Disconnected, read-only. The customers will only be accessing historical data, and not
making current transactions over the Internet.

Scenario 2
A group of scientists is conducting an experiment that requires a system that will store and display data
for 50 participants. The application must continually measure physiological responses to stimuli that are
coordinated by the experimenters. One constraint of the experiment is that the experimenters must stop
the stimuli manually for one hour when the system alerts them that 60 percent of the participants have
reached a level 8 in four of 10 measurements.
Answer: Connected, read/write. The data must be constantly updated into totals, which requires a
connected environment. Data from recent time periods must be calculated into the current levels,
which requires writing to the data in addition to reading it.

Scenario 3
A system needs to be created for a photo finishing service that allows its customers to submit scanned or
mailed-in photos, pay for services over the Internet, and check the status of their orders.
Answer: Disconnected, read/write. The reviewing of orders is read-only. The creation of new
orders, including the submittal of the photos, is read/write.

Scenario 4
A system needs to be created for a mobile sales team. Each salesperson must be able to connect to the
office wide area network, the company intranet, and the Internet by using mobile communication devices.
The salespeople are responsible for creating and submitting customer orders in the field, after verifying
availability of stock and appropriate credit availability. They will also need to check on customer
shipments and order status, and submit daily reports regardless of whether they can establish an Internet
connection. The system requirements state that appropriate deductions and credits to inventory and
shipping must occur twice each day. The salespeople must be able to verify, but not change, credit
account balances for customers.
Using ADO.NET 11-3

Answer: Disconnected, read/write access for processing orders, shipments, and inventory data
even during dial-up connections over cellular phone modems. Read-only access to customer credit
information.

Scenario 5
A firm of financial traders needs access to the data of three different stock markets and to a separate
internal database that tracks the transactions of the traders for their customers. The internal database
receives continuous downloads from the stock market data flow. Data for each trader's customers is
replicated locally on the hard disk of the trader's personal computer. The trader uses this data to maintain
accounts for two or three customers, plan projected trades, and complete these trades each day. What
data environment and access permissions are required between the individual traders' personal
computers and the internal database?

Answer: Disconnected, read/write. The individual traders can get microsecond updates of the
stock market data. This scenario would require a disconnected environment with read-only access.
The internal database and the individual traders would also operate in a disconnected but rapidly
updating environment, requiring read/write capability.

Review Answers
1. What is the primary difference between a connected and disconnected environment?
Answer: A connected environment is one in which a user or an application is constantly
connected to a data source.
A disconnected environment is one in which a user or an application is not constantly
connected to a source of data. Users can take a subset of data with them on a disconnected
computer, and then merge changes back into the central data store at their convenience.
2. Write an SQL statement that will select all fields from a table named Customers.
Answer:

SELECT * FROM Customers

3. Identify the ADO.NET object that you use to manage the communication between a connection
and a dataset.
Answer: The DataAdapter.
4. Examine the following code and answer these questions.
a. What is the name of the connection object?
b. What type of provider has been selected?

c. What is the file name of the database?

Dim NWindOleDbConn As OleDb.OleDbConnection


NWindOleDbConn = New OleDb.OleDbConnection( )
NWindOleDbConn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\NWind.MDB"
NWindOleDbConn.Open( )

Answer:
a. NWindOleDbConn
b. OleDb .NET Data Provider
11-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

c. NWind.MDB
5. Write code to generate the dataset for YourDataSet by using the YourDataAdapter data adapter.
The table from which you extract the data is named YourTable. You can assume that both the
dataset and adapter have already been declared.
Answer:

YourDataAdapter.Fill(YourDataSet, "YourTable")

6. What is the name of the Windows Forms control that you can use to display multiple records
retrieved from a data source?
Answer: The DataGrid control.
7. What properties of the DataGrid control can you use at design time to bind it to a data source?
Answer: The DataSource and DataMember properties.
Deploying Applications 12-1

Module 12
Deploying Applications
Contents:
Question and Answers 2
Multimedia 3
12-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Question and Answers


Review Answers
1. Which of the following options can you use to package your code for distribution? (Select all true
answers.)
a. As .cab files
b. As XCOPY project files
c. As a Windows Installer package
d. As a Microsoft .NET Solution Installer package

Answer: Both a and c are correct.


2. Evaluate whether each of the following statements is true or false. For any false statement, explain
why it is false.
a. You must package merge modules within a Windows Installer for distribution to end-users.
b. You can uninstall any Windows-based application by using the Add or Remove Programs
option in Control Panel.
c. You must include a bootstrapper in an installer if your application will be installed on
versions of Windows previous to Windows XP.
Answer:
a. True.
b. False. Only applications that were installed by means of Windows Installer can be
uninstalled by using the Add or Remove Programs option.

c. True.
3. What is the purpose of the Dotnetfx.exe file?
Answer: Dotnetfx.exe is a redistributable installer that can be used to install the common
language runtime and .NET Framework components necessary to run .NET Framework
applications.
Deploying Applications 12-3

Multimedia
Media Type Title

Demonstration Deploying a Windows-based Application


Introduction to Visual Basic .NET Programming with Microsoft .NET R-1

Resources
Contents:
Additional Reading 2
Internet Links 5
R-2 Introduction to Visual Basic .NET Programming with Microsoft .NET

Additional Reading
This section contains references to books, articles, and other courses that provide in-depth discussion
about technical topics related to this course. The links in the additional reading files included on this
compact disc are not supported. Some links require that Microsoft Visual Studio .NET be installed.

General Reference
Microsoft Visual Basic .NET Step by Step
Michael Halvorson (MS Press) ISBN 0735613745

Module 1
Microsoft Windows User Experience
Microsoft Corporation Microsoft Press ISBN 0735605661
NET Framework Product Overview.doc
(from http://msdn.microsoft.com/netframework/prodinfo/frameworkfacts.asp)

Module 2
Course 2565A, Developing Microsoft .NET Applications for Windows (Visual Basic .NET)
Windows Forms: A Modern-Day Programming Model for Writing GUI Applications
(from http://msdn.microsoft.com/msdnmag/issues/01/02/WinForms/WinForms.asp)
Windows Forms Controls By Function
(from ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconSelectingWFCClientControl.htm)

Module 3
Variable and Method Scope in Microsoft .NET
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dndotnet/html/methodscope.asp)

Module 4
Structure of a Visual Basic Program
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vbcn7/html/vaconvisualbasicmodules.asp)

Module 6
Debugging Microsoft .NET and Windows Applications
John Robbins (Microsoft Corporation) ISBN 0735615365
Introduction to Visual Basic .NET Programming with Microsoft .NET R-3

Module 7
Writing Secure Code
Michael Howard and David LeBlanc (Microsoft Press) ISBN 0735615888

Module 8
Best Practices for Handling Exceptions
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpconbestpractice sforhandlingexceptions.asp)

Module 10
An Introduction to Microsoft .NET Remoting Framework
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dndotnet/html/introremoting.asp)
Remoting and XML Web Services in Visual Basic .NET
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnadvnet/html/vbnet10232001.asp)

Module 11
Structure of a Visual Basic Program.htm
Dushan Bilbija, Paul Dickenson, Fabrio Claudio Ferracchiati, Jefferey Hasan, Naveen Kohli, John
McTainsh, Matt Milner, Jan D. Narkiewicz, Adil Rehan, Jon D. Reid (Wrox Press) ISBN
186100558X
ADO.NET Architecture
(from ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconadonetarchitecture.htm)
Introduction to Data Concurrency in ADO.NET"
(from ms-
help://MS.VSCC/MS.MSDNVS/vbcon/html/vbtskPerformingOptimisticConcurrencyChecking.htm)
Data Binding and Windows Forms
(from ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vboriDataBindingWindowsForms.htm)
How to Transfer Data to an Excel Workbook by Using Visual Basic .NET (Q306022)
(from http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306022&GSSNB=1)

Module 12
Simplifying Deployment and Solving DLL Hell with the .NET Framework
R-4 Introduction to Visual Basic .NET Programming with Microsoft .NET

(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dndotnet/html/dplywithnet.asp)
Determining When to Use Windows Installer Versus XCOPY
(from http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dndotnet/html/xcopywininst.asp)
Introduction to Visual Basic .NET Programming with Microsoft .NET R-5

Internet Links
The Web sites listed below provide additional resources.

Web Site URL

Microsoft Corporation http://www.microsoft.com



Microsoft Windows http://www.microsoft.com/windows
Microsoft Internet Explorer http://www.microsoft.com/windows/ie
Microsoft Product Support Services http://support.microsoft.com
Microsoft Knowledge Base http://search.support.microsoft.com/kb
Microsoft Training and Certification http://www.microsoft.com/traincert

This section contains references to Web resources that provide in-depth discussion about technical topics
related to this course.
Visual Studio .NET Automated Demos
http://msdn.microsoft.com/vstudio/productinfo/demos/default.asp
Programming with the .NET Framework
http://www.msdn.microsoft.com/library/default.asp?url=/library/en
us/cpguide/html/cpconprogrammingwithnetframework.asp
What's New in Visual Basic and Visual C#TM
http://msdn.microsoft.com/library/default.asp?url=/library/en us/vbcon/html/vboriwhatsnewvb70.asp
Visual Basic Language Features
http://msdn.microsoft.com/library/default.asp?url=/library/en
us/vbcn7/html/vaconTheVisualBasicLanguageDescribed.asp
Using the Debugger
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vsdebug/html/_asug_how_do_i_topics3a_debugging.asp
Testing
http://msdn.microsoft.com/library/default.asp?url=/library/en us/vsent7/html/vxoritestingoptimizing.asp
XML Web Services
http://msdn.microsoft.com/vstudio/techinfo/articles/XMLwebservices/webdefault.asp
NET Framework Deployment Guide
http://msdn.microsoft.com/library/default.asp?url=/library/en us/dnnetdep/html/dotnetframedepguid.asp
R-6 Introduction to Visual Basic .NET Programming with Microsoft .NET

Send Us Your Feedback


You can search the Microsoft Knowledge Base for known issues at Microsoft Help and Support before
submitting feedback. Search using either the course number and revision, or the course title.

Note Not all training products will have a Knowledge Base article if that is the case, please ask your
instructor whether or not there are existing error log entries.

Courseware Feedback
Send all courseware feedback to [email protected]. We truly appreciate your time and effort.
We review every e-mail received and forward the information on to the appropriate team. Unfortunately,
because of volume, we are unable to provide a response but we may use your feedback to improve your
future experience with Microsoft Learning products.

Reporting Errors
When providing feedback, include the training product name and number in the subject line of your e-
mail. When you provide comments or report bugs, please include the following:
Document or CD part number
Page number or location
Complete description of the error or suggested change
Please provide any details that are necessary to help us verify the issue.

Important All errors and suggestions are evaluated, but only those that are validated are added to the
product Knowledge Base article.

You might also like