Print this page Share
Professional VB.NET, 2nd Edition (0764544004) cover image


What is this book about?

.NET is designed to provide a new environment within which you can develop almost any application to run on Windows (and possibly in the future on other platforms). Visual Basic .NET (VB.NET) is likely to be a very popular development tool for use with this framework. VB.NET is a .NET compliant language and, as such, has (except for legacy reasons) almost identical technical functionality as the new C# language and Managed Extensions for C++. Using VB.NET, you can develop a dynamic Web page, a component of a distributed application, a database access component, or a classic Windows desktop application.

In order to incorporate Visual Basic into the .NET Framework, a number of new features have been added to it. In fact, the changes are so extensive that VB.NET should be viewed as a new language rather than simply as Visual Basic 7. However, these changes were necessary to give developers the features that they have been asking for: true object orientated programming, easier deployment, better interoperability, and a cohesive environment in which to develop applications.

What does this book cover?

In this book, we cover VB.NET virtually from start to finish: We begin by looking at the .NET Framework, and end by looking at best practices for deploying .NET applications. In between, we look at everything from database access to integration with other technologies such as XML, along with investigating the new features in detail. You will see that VB.NET has emerged as a powerful yet easy to use language that will allow you to target the Internet just as easily as the desktop.

This book explains the underlying philosophy and design of the .NET Framework and Common Language Runtime (CLR) and explains the differences between Visual Basic 6 and Visual Basic .NET.

You will learn how to

  • Develop applications and components using Visual Studio .NET
  • Effectively apply inheritance and interfaces when designing objects and components
  • Organize your code using namespaces
  • Handle errors using the Try...Catch...Finally structure
  • Access data using ADO.NET and bind controls to the underlying data sources
  • Create Windows applications and custom Windows controls
  • Interoperate with COM and ActiveX components
  • Create transactional and queuing components
  • Use .NET Remoting to send serialized objects between clients and servers
  • Create Windows Services
  • Use VB.NET to access information on the Web
  • Create and consume Web Services
  • Secure your applications and code using the tools provided in the .NET Framework SDK
  • Arrange your applications and libraries in assemblies and deploy them using Visual Studio .NET

Who is this book for?

This book is aimed at experienced Visual Basic developers who want to make the transition to VB.NET.

What do you need to use this book?

Although it is possible to create VB.NET applications using the command lines tools contained in the .NET Framework SDK, you will need Visual Studio .NET (Professional or higher), which includes the .NET Framework SDK, to use this book to the full.

Here are some additional notes on what you may need:

  • Some chapters make use of SQL Server 2000. However, you can also run the example code using MSDE (Microsoft Data Engine), which ships with Visual Studio .NET.
  • Several chapters make use of Internet Information Services (IIS). IIS ships with Windows 2000 Server, Windows 2000 Professional, and Windows XP, although it is not installed by default.
  • Chapter 18 makes use of MSMQ to work with queued transactions. MSMQ ships with Windows 2000 Server, Windows 2000 Professional, and Windows XP, although it is not installed by default.
See More

Table of Contents

Chapter 1: What is Microsoft .NET?

Chapter 2: Introducing VB.NET and VS.NET.

Chapter 3: The Common Language Runtime.

Chapter 4: Variables and Types.

Chapter 5: Object Syntax Introduction.

Chapter 6: Inheritance and Interfaces.

Chapter 7: Applying Objects and Components.

Chapter 8: Namespaces.

Chapter 9: Error Handling.

Chapter 10: Using XML in VB.NET.

Chapter 11: Data Access with ADO.NET.

Chapter 12: Windows Forms.

Chapter 13: Creating Windows Controls.

Chapter 14: Web Forms.

Chapter 15: Creating Web Controls.

Chapter 16: Data Binding.

Chapter 17: Working with Classic COM and Interfaces.

Chapter 18: Component Services.

Chapter 19: Threading.

Chapter 20: Remoting.

Chapter 21: Windows Services.

Chapter 22: Web Services.

Chapter 23: VB.NET and the Internet.

Chapter 24: Security in the .NET Framework.

Chapter 25: Assemblies and Deployment.

Appendix A: Using the Visual Basic Compatibility Library.

See More

Author Information

Fred Barwell is an MCSD and a graduate from the University of Waterloo with a Bachelor of Mathematics, Honors Computer Science and Information Systems degree. He has been developing software professionally for over 10 years, primarily with Visual Basic and SQL Server.

Richard Blair is Web Application Architect specializing in Microsoft Web Technologies, He focuses on emerging technology and its impact on business and development. Key areas that he has helped clients evaluate include: streamlining the electronic business process, expanding access to vital information, and creating usable systems. He now works as a Senior Consultant for SEI-Information Technology.

Richard Case is a Financial Analyst Programmer with Financial Objects PLC based in Covent Garden, London, England, where he works on the company’s advanced banking software. Richard is also a Microsoft Certified Developer. He has been using Visual Basic since version 3 and is looking forward to using it for many years to come.

Jonathan Crossland is co-author of Professional Windows DNA, Professional VB.NET, and Beginning VB.NET. He is currently working at Yokogawa Electric Corporation in the UK, where he is happily involved with the creation of software technologies for eight years and now spends most of his time in C# and ASP.NET.

Bill Forgey is Technical Lead in his current position, introducing project methodology, new technologies, standards, and training to development teams. He spend some time consulting and have exposed to technologies such as ASP, Delphi, Pascal, COM, C/C++, SQL, Java, ADO, Visual Basic, and now .NET. He is also co-author to Beginning Visual Basic .NET Databases.

Whitney Hankison is a Financial Systems Analyst with the County of Santa Barbara in California. She specializes in VB programming and System Architecture/Network Configuration. She has been working in the computer field since 1984 and holds MCP certifications in NT Server and Workstation.

Billy S. Hollis first learned BASIC over 25 years ago, and is co-author of the first book ever published on Visual Basic .NET, VB.NET Programming on the Public Beta, as well as several other .NET books. He is a frequent speaker at conferences, including Comdex and the Visual Basic Insiders Technical Summit (VBITS), often on the topics of software design and specification, object-based development in Visual Basic, and Microsoft.NET. He was chosen by Microsoft to train 200 instructors for their 2001 .NET Developer Tour.

Rockford Lhotka is the Principal Technology Evangelist for Magnetic Technologies, one of the Nation’s premiere Microsoft Gold Certified Partners dedicated to solving today’s most challenging business problems using 100% Microsoft tools and technology. He has over 14 years experience in software development and has worked on many projects in various roles, including software architecture, design and development, network administration, and project management.

Tim McCarthy is a Principal Engineer at InterKnowlogy, where he architects and builds highly scalable n-tier web applications utilizing the latest Microsoft technologies. He has been an author and technical reviewer for several books.

Jan D. Narkiewicz is Chief Technical Officer at Software Pronto, Inc. In his spare time he is Academia Coordination for the Windows curriculum at U.C. Berkeley Extension, he teaches at U.C. Santa Cruz Extension, writes for ASPT today and occasionally plays some football.

Jonathan Pinnock started programming in Pal III assembler on his school’s PDP 8/e, with a massive 4K of memory. He spends most of his time developing and extending the increasingly successful PlatformOne product set that his company, JPA, markets to the financial services community.

Rama Ramachandran is Vice President, Technology with Imperium, a Microsoft Certified Partner for E-Commerce, Rama is a Microsoft Certified Solution Developer and Site-Builder and has excelled in designing and developing medium to large scale web applications using .NET, ASP/+, COM, Visual Basic, SQL Server, and Windows 2000.

Mathew Reynolds is an in-house author for Wrox Press writing about and working with visually all aspects of Microsoft .NET. He is also a regular contributor to Wrox’s ASPToday, C#Today and Web Services Architect.

John Roth began his career like so many in the industry as that guy who knows the computer stuff, the one who could whip up a macro as fast as Julia Childs could tuck into a Souffle. Realizing he could make a living having fun, he started his own company.

Bill Sempf is an experienced internet strategist with a ten-year track record of using technology to help organizations accomplish specific business objectives. He is a Microsoft Certified Professional, Certified Internet Business Strategist, and member of the International Webmaster’s Association.

Bill Sheldon is a software architect and engineer originally from Baltimore, Maryland, currently living with his wife in Southern California. Holding a degree in Computer Science from the Illinois Institute of Technology (IIT), he has been professionally employed since resigning his commission with the US Navy following the Gulf War.

See More


Download TitleSizeDownload
Code Download for Professional VB.NET 2nd Edition 914.09 KB Click to Download
See More


Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
0 Use of Imports System

If you're not using Visual Studio .NET (any edition) to run the examples in the book you'll need to include Imports statements within your code. See page 261 for details about the Imports statement. At the very least, you'll need to import the System namespace for every example:

Imports System
11-Feb-03 1
2 41 Adding an Event Handler
If you haven't included an Imports System.Windows.Forms statement you will need to fully-qualify the calls to the MessageBoxbuttons MessageBoxIcon enumerations:
System.Windows.Forms.MessageBox.Show("Hello World", _
    "A First Look at VB.NET", _
    System.Windows.Forms.MessageBoxButtons.OK, _
06-Jan-03 1
58 Better Support for Versioning

The version number of an assembly takes the form: Major.Minor.Build.Revision, not Major.Minor.Revision.Build.

17-Jul-02 1
60 Cyclical References
The sentence, "Next we explicitly set objA and objA to Nothing, ???" in the penultimate paragraph should read "Next we explicitly set objA and objB to Nothing, ???"
22-Jul-02 1
3 64 Use Console.WriteLine instead of Debug.WriteLine

The example programs on pages 64 - 66 use Debug.WriteLine to print statements instead of Console.WriteLine. In each case the call to Debug.WriteLine should be replaced with a call to Console.WriteLine, in order for the statements to be printed to the command line.

11-Feb-03 1
4 77 System.Text.StringBuilder

The final sentence of the first paragraph should read, "Consider the following code, which uses the System.Text.StringBuilder class:"

11-Feb-03 77
83 Single

The final paragraph on this page should refer to Singles, not Shorts - as reflected in the code.

27-Jun-02 1
88 Performing Explicit Conversions

The first line of code on this page should check if lngLong is less than Short.MaxValue rather than greater than:

If lngLong < Short.MaxValue Then
06-Nov-02 1
4 90 Option Strict not Object Strict

The final paragraph on this page refers to "Object Strict". It should refer to "Option Strict".

06-Jan-03 1
102 Passing ByValue

The 4th bullet in the summary should read, "Beware that parameters are passed ByValue by default so changes are not returned."

17-Jul-02 1
139 The IDisposable Interface

The final two lines of code on this page contain parantheses that break the code. The code should read:

CType(mobjPerson, IDisposable).Dispose()

mobjPerson = Nothing
25-Jul-02 1
142 Method Signatures

The final paragraph of the Method Signatures section states that the ByRef and ByVal modifiers can be used to create distinct method signatures. This is incorrect. ByVal and ByRef cannot be used as a differentiating feature when overloading a property or procedure.

02-Jul-02 1
162 Creating a Base Class

mdtBirthDate should be declared as a Date, not a String:

Private mdtBirthDate As Date
25-Sep-02 1
167 Overloading Methods

The code that checks if a key is present in the HashTable should read:

If mcolNames.ContainsKey(Type) Then mcolNames.Item(Type) = Value Else
19-Jul-02 1
177 Checking if a key exists in the HashTable

The code that checks if a key is present in the HashTable should read:

If mcolNames.ContainsKey(Type) Then mcolNames.Item(Type) = Value Else
19-Jul-02 1
190 The Me Keyword

The 2nd paragraph on this page should read, "..., we also need to comment out the lines that refer to the OfficeNumber property, ..."

17-Jul-02 1
6 191 The MyBase Keyword

The MyBase keyword cannot be used to invoke a Friend element from the parent class if the parent class is in a different assembly.

06-Jan-03 1
196 Checking if a key exists in the HashTable

The code that checks if a key exists in the HashTable should read:

>If mcolNames.ContainsKey(Type) Then
    mcolNames.Item(Type) = Value
19-Jul-02 1
214 Implementing IPrintableObject

The final paragraph on this page should read, "We can then move on to implement the other two elements defined..."

30-Aug-02 1
215 Reusing Common Implementation

The third paragraph of the Reusing Common Implementation section should read, "..., our Value method is linked to IPrintableObject.Value using this clause:"

17-Jul-02 1
232 Selecting the Add Reference menu option

The first paragraph on this page should read, "... Do this by clicking on the project name in the Solution Explorer window and..."

17-Jul-02 1
244 Implementing IPrintableObject

The method declaration for PrintPage() should include an underscore character at the end of the second line top indicate that the declaration continues onto the next line:

ByVal ev As System.Drawing.Printing.PrintPageEventArgs) _
17-Jul-02 1
256 Adding a Reference

The fourth paragraph should read, "... Selecting the Microsoft Visual Basic.NET Compatability Runtime component..."

17-Jul-02 1
289 Writing to Trace Files

In order to use the example code on page 289 you will need to import System.IO, by adding a Imports System.IO statement to your code. In addition, so that the code will run even if the C:\mytext.txt file does not exist the first statement in the LoggingExample2() sub should read:

Dim objWriter As New IO.StreamWriter("c:\mytext.txt", True)
25-Sep-02 1
303 Misspelling of "prescription"

Please not that "prescription" is misspelt as "presciption" several times in the example code in this chapter.

17-Oct-02 1
308 Code for managing the XML stream

The first line of code on this page should read:

Dim prescriptionTextWriter As XmlTextWriter = Nothing
16-Oct-02 1
10 334 ADO.NET and XML

The final sentence of the first paragraph on this page should read, "An example code snippet that uses the GetXml method is as follows:". The code is presented as a snippet only and so is not included in the code download for the book.

13-Mar-03 3
341 Corrupted XML

The XML shown on this page should read:

<xs:element name="Authors">
<xs:element name="au_id" type="xs:string" minOccurs="0" />
<xs:element name="au_lname" type="xs:string" minOccurs="0" />
<xs:element name="au_fname" type="xs:string" minOccurs="0" />
<xs:element name="phone" type="xs:string" minOccurs="0" />
<xs:element name="address" type="xs:string" minOccurs="0" />
<xs:element name="city" type="xs:string" minOccurs="0" />
<xs:element name="state" type="xs:string" minOccurs="0" />
<xs:element name="zip" type="xs:string" minOccurs="0" />
<xs:element name="contract" type="xs:boolean" minOccurs="0" />
17-Jul-02 1
353 Command Object

Please note that the code on this page is extracted from the TraverseDataReader method on the following page. You'll need to wait until page 354 to find the complete code necessary to run the example demonstrating the Command object.

17-Oct-02 1
366 Stored Procedures

In response to reader feedback some clarification about stored procedures is required. The book states stored procedures are compiled prior to execution. In fact, a stored procedure in SQL Server 7 and 2000 is compiled at execution time, just like any other T-SQL statement. The execution plan of the SQL statement is cached and SQL Server uses algorithms to reuse these execution plans efficiently.

[You can find more information about stored procedures in SQL Server in the Stored Procedures and Execution Plans section of SQL Server Books Online.]

17-Oct-02 1
409 The Validating Event

The code that checks if the password is blank should read:

If passwordTextbox.Text = "" Then
  MessageBox.Show("Password cannot be blank")
End If
17-Jul-02 1
13 442 Setting a default value - Clarification

Using a <DefaultValue> attribute will allow designers (such as Visual Studio .NET) to set the property to a default value but please note that your property still needs to be set to an intitial value in code so that it can be used outside of such designers.

09-Jan-03 1
13 447 DefaultMaxSelectedItems() Method
The DefaultMaxSelectedItems() method is missing a line continuation character ('_'). The code should read:
Private Function DefaultMaxSelectedItems() As Integer
  Dim attributes As AttributeCollection = _
    TypeDescriptor.GetProperties(Me) ("MaxItemsSelected").Attributes
  Dim myAttribute As DefaultValueAttribute = _
    CType(attributes(GetType(DefaultValueAttribute)), _
  Return CInt(myAttribute.Value)
End Function
24-Feb-03 1
13 449 LimitedCheckedListBox1

The first paragraph refers to CheckedListBox1; it should refer to LimitedCheckedListBox1.

24-Feb-03 1
460 The OnPaint Method method of the Control base class

The first line of the OnPaint() method code should read:

Protected Overrides Sub OnPaint( _
18-Jul-02 1
491 Postback Versus Non-Postback Events

The first line on this page should read, "Client-side events are automatically processed in the client browser without making a round trip to the server. So, for..."

30-Aug-02 1
525 Reusing Code in a Web User Control

This page incorrectly states that you cannot use a @OutputCache directive in a Web User Control, when in fact you can.

30-Aug-02 1
528 Exposing Custom Properties

Note that you will need to alter the code for the table element of the navigation bar in order to use the BackColor custom property

<table id="tblNavBar" bgcolor="<%=BackColor%>" width="100%" height="100%" style="FONT-SIZE:10pt;FONT-FAMILY:verdana">
17-Oct-02 1
561 Saving Changes

The menuSaveChanges_Click method is missing a Handles statement. It should read:

Private Sub menuSaveChanges_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles menuSaveChanges.Click
17-Jul-02 1
16 564 Corrected Stored Procedure

The thirds stored procedure on this page has a spelling mistake (sp_exectsql instead of sp_executesql) and doesn't declare the third parameter. It should read: exec sp_executesql N'UPDATE authors SET city=@p1, state=@p2 WHERE au_id=@p3, N'@p1 varchar(10), @p2 char(2), @p3 varchar(11), @p1 = 'Scottsdale', @p2 = 'AZ', @p3 = '238-95-7766'

23-Jan-03 1
579 Saving Changes

The code for the ColumnChanged() event handler should be:

17-Jul-02 1
595 Late-Binding

The comments in the code on this page include some dots where there should be double-quote marks. The correct comment is:

Set myObj = New MyObj ' or Set myObj = CreateObject ("MyLibrary.MyObject")
18-May-02 1
698 Viewing WSDL

The first line of the final paragraph on this page should read, "To test this out, take the HTTP URL and add ?WSDL on to the end."

26-Sep-02 1
24 836 Building an assembly with a strong name

The screenshot and instructions on page 836 for adding a strong name are incorrect. In the final release of Visual Studio .NET 2002 the Strong Name tab in the Common Properties section of the Property Pages dialog has been removed.

Instead, you should use the AssemblyKeyFile attribute in an Assembly Information File, as described here.

18-Dec-02 1
940 SendKeys

The SendKeys class has been moved to the System.Windows.Forms namespace not the System.IO namespace.

07-Oct-02 1
See More

Related Titles

Back to Top