Skip to main content

Beginning Visual Basic 2005

Thearon Willis, Bryan Newsome

ISBN: 978-0-764-57401-6

Nov 2005

840 pages

Select type: Paperback

Product not available for purchase


  • After a brief introduction to Visual Studio 2005 and the .Net Framework, the expert authors introduce readers to the fundamentals of the Visual Basic 2005 language
  • End-of-chapter exercises help readers to quickly learn to build rich and professional-looking applications for Microsoft Windows, intranets and the Internet, and mobile devices
  • Offers thorough coverage of the new Visual Studio 2005 tools and features
  • Covers object-oriented programming, creating custom controls, working with databases, creating menus, and working with graphics
  • Addresses building class libraries, Web services and .NET remoting, and deploying applications


Chapter 1: Welcome to Visual Basic 2005.

Chapter 2: The Microsoft .NET Framework.

Chapter 3: Writing Software.

Chapter 4: Controlling the Flow.

Chapter 5: Working with Data Structures.

Chapter 6: Building Windows Applications.

Chapter 7: Displaying Dialog Boxes.

Chapter 8: Creating Menus.

Chapter 9: Debugging and Error Handling.

Chapter 10: Building Objects.

Chapter 11: Advanced Object-Oriented Techniques.

Chapter 12: Building Class Libraries.

Chapter 13: Creating Your Own Custom Controls.

Chapter 14: Programming Custom Graphics.

Chapter 15: Accessing Databases.

Chapter 16: Database Programming with SQL Server and ADO.NET.

Chapter 17: Web Forms.

Chapter 18: Forms Authentication.

Chapter 19: Visual Basic 2005 and XML.

Chapter 20: Web Services and .NET Remoting.

Chapter 21: Deploying Your Application.

Chapter 22: Building Mobile Applications.

Appendix A: Where To Now?

Appendix B: Implementing the Microsoft Solutions Framework.

Appendix C: An Introduction to Security.

Appendix D: Solutions.


Code Downloads
Code downloads for this title are available here.
Code Downloads
Code Downloads
Code downloads for this title are available here.
Code Downloads
ChapterPageDetailsDatePrint Run
Default behavior of the DialogResult enumeration
The RTM version of Visual Studio 2005 changed the default behavior of the DialogResult enumeration.

In the book and in the downloaded code you will find examples such as DialogResult.OK. These dialog result enumerations must be fully qualified with the Windows.Forms namespace.

For example, DialogResult.OK should be written as Windows.Forms.DialogResult.OK. This applies to all DialogResult enumerations.

Database Explorer should be Server Explorer
Throughout the book, any references to Database Explorer should be Server Explorer.

14Error in Text
Try It Out, Step 1, line 2 reads:
'click the _ button in the top-right...'

It should read:
'click the X button in the top-right...'

47Error in Text
under heading "Integer Math Shorthand" --

"In the next Try It Out, you'll see how can perform"

should be:

"In the next Try It Out, you'll see how you can perform"
"In the next Try It Out, you'll see how to perform"

59Error in Text
In "Try It Out" Item 2:

'Replace the string occurance

should be:

'Replace the string occurrence

60Error in Code
example code for the "Displaying the Current Date" Try It Out: the last line to input:
MessageBox.Show(dteData, "Data Demo").

This fails to build if Option Strict is On. If Option Strict is Off, it builds and runs.

If you already have Visual Studio 2005 installed and running,if you try to run some of these tutorials with it on, you will get build errors.

Add: ".ToString" to the variable name, rendering...
MessageBox.Show(dteData.ToString, "Data Demo").

the first sentence in the last paragraph:
with base twp

should be:
with base two

76Error in Text
Second paragraph third sentence --

"you change it in once place"

should be:

"you change it in one place"

76 & 77Error in Code
Last line should be MessageBox.Show(dblArea.ToString, "Area").

120Error in Text
How it Works, Second Paragraph

m (from "the 1 to 3 loop, which results in m being incremented.")
should be:
intLoop2 (becoming "the 1 to 3 loop, which results in intLoop2 being incremented.")

120Error in Text
Second paragraph, second sentence under How It Works:

which results in m being incremented

should be:

which results in intLoop2 being incremented.

134Error in Code
For intIndex as Integer ....
Code reads:

Should read:

140Error in Code
Visual Basic 2005. 'Try it Out' at bottom of page lists:
If value >= 6 and value < 7 then
CurrentState =

Should read:
If value >= 6 and value < 7 then
CurrentState =

218Step 8 Code Snippet
step 8, inserting code snippets.

There was a change between the last beta and the RTM So, when you go to "File System - Processing Drives, Folders, and Files" and then double click the "Read text from a file" different code will be inserted.

The following is the code inserted inside the "if statement"....

If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK
Dim fileContents As String
fileContents = My.Computer.FileSystem.ReadAllText("C:\Test.txt")
End If"

218Error in Code
For step 9:

Modify the code as shown:

If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
'Save the file name
strFileName = OpenFileDialog1.FileName
'Read the contents of the file
Dim fileContents As String
fileContents = My.Computer.FileSystem.ReadAllText(strFileName
'Display the file contents in the TextBox
txtFile.Text = fileContents
End If

149Error in Text
Try It Out, Item 1, Beginning Sentence:

Wrong type face for Name. It should be in the same type face as the sentence not in the type face of the code.

222Error in File Name
Step 5:
the code that isinserted is: My.Computer.FileSystem.WriteAllText("C:\Test.txt","Text", True)
there is no Write New Text Files
should be:
a Write Text to a File.

235Text Deletions
Printing using the PrintDocument class requires a lot of coding and knowledge of how actual printing works. Fortunately, the .NET Framework provides the My.Computer.Printers namespace, which simplifies your job as a developer.

This namespace wraps up all the complexities of printing and provides you with methods and properties that allow you to print a text document with ease and just a few lines of code. You can use the DefaultPrinter method of this namespace to print to the default printer, or you can use the Item property to specify the printer that you want to print to. Using either one, you can print a text document with as little as two lines of code, as shown in this code snippet:

With My.Computer.Printers.DefaultPrinter
End With

In the Print A Document section was left over from the original text for this book. This entire section along with the code had to be rewritten during CE-AR edits due to changes in the software.

236Error in Text
In the code in Step 6:
should be prefixed with:
so the code reads:


243Text Error
The Try It Out heading:

the ColorDialog Control
should be:
Working with the FolderBrowserDialog Control

422Error in Text
second sentence of the step 3 in the "Try It Out":

"Right-click the Secure Login project in the Solution Explorer..."

should be read as:

"Right-click the Access Control project in the Solution Explorer..."

17558Error in Text
Step 7 DefaultClientScript Property:

You can switch to source view on the default.aspx page. That is at the bottom left of the design area. In between the start and end <head> tags put the following:

<meta content="text/VBScript" http-equiv="content-script-type" />

563Error in Text
first bullet of step 6:
"Sert ID to rfvFirstName"
should be:
"Set ID to rfvFirstName"

566Error in Text
4.3 :
Server Explorer

should be:
Solution Explorer

681New method
The method ChannelServices.RegisterChannel(channel) is now obsolete. Although it will compile with only a warning and still work, you should use the new method signature ChannelServices.RegisterChannel(channel, False).

1007Error in Figure
Figure 20-15:

IDC_CANCELORDER should be IDC_CANCEL to be consistent with the code download.

1007Error in Figure
Figure 20-17:


should be: