Wrox Home  

Topic: Visual Basic

Professional VB.NET, 2nd Edition (0764544004) cover image

Professional VB.NET, 2nd Edition

Fred Barwell, Richard Case, Bill Forgey, Billy Hollis, Tim McCarthy, Jonathan Pinnock, Richard Blair, Jonathan Crossland, Whitney Hankison, Rockford Lhotka, Jan D. Narkiewicz, Rama Ramachandran, Matthew Reynolds, John Roth, Bill Sheldon, Bill Sempf
ISBN: 978-0-7645-4400-2
1032 pages
April 2002
This title is out-of-print and not currently available for purchase from this site.

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
Printer-Ready Version   Share This
With you wherever you go: pdf + ePub + kindle -- DRM-free