Topic: Visual Basic

Wrox's Visual Basic® 2005 Express Edition Starter Kit (0764595733) cover image

Wrox's Visual Basic® 2005 Express Edition Starter Kit

Andrew Parsons
ISBN: 978-0-7645-9573-8
Paperback
384 pages
January 2006
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
2 22 URL Error
The URL for the instruction to download the "Amazon-Enabled Movie Collection Starter Kit", was modified by Microsoft to the following:

URL: http://msdn.microsoft.com/vstudio/eula.aspx?id=72a940c3-befe-4013-a08f-b9032244e414
11/07/06
73 Error in Technical Text
The code execution table (below the actual code) should have the integer value of "21" for the variable "MyResult", instead of "0".
03/31/2006
76 Error in Text
first paragraph:
a variable of type Decimal is declared

should read:
a variable of type Double is declared
8/03/06
78 Error in Text
On page 78 the book provides the format of the IIf statement as:
IIf(Condition, TrueValue, FalseValue)

It then sets the following example for determining cake pricing:
"If chocolate cakes were priced at $2 but all other cakes were only $1, the price of a particular cake could be calculated as follows:
Price=IIF(Cake.Type="Chocolate",1,2)"

The above statement would set the price of chocolate cakes to $1 and all other cakes to $2.
04/10/2006
113 Error in Text
Section 3,last line reads:
"dtpBirthdate.Value = mPerson.BirthDate" gets blue-lined, tool-tip is "Name dtpBirthdate is not declared"

In the website download code, the variable is "dtpDateOfBirth", which is declared.
05/22/2006
117 Error in Code
step 3 of the Try it Out:
".Anchor = AnchorStyles.Bottom + AnchorStyles.Right"

should be:
".Anchor = CType(AnchorStyles.Bottom + AnchorStyles.Right, AnchorStyles)"
5/02/06
7 126 Error in Code
Chapter 7, page 126, Section 6:

When the application is run and the 'Show List' button is clicked, the list box is NOT populated with the information in the database.

The connection string specified in the application configuration XML file (app.config) does not match the database file location specified in the database properties (PO_Data.mdf) connection string. It is also the reason that the example code would not run in Chapter 8 and Chapter 9 and the problem may carry over to the later chapters as well.

Listed below are the two conflicting connection string specifications:

App.Config XML File Connection String:
<connectionStrings>
<add name="Personal_Organizer.Settings.PO_DataConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="H:\Wiley-2\Wrox Visual Basic Express 2005 Starter Kit\Code\Chapter 9\Personal Organizer Database File\PO-Data.mdf";Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>


PO_Data.mdf Properties Connection String:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Documents and Settings\User Name\My Documents\Visual Studio 2005\VB_2005_Express_Code\Chapter 09\Personal Organizer Database File\PO-Data.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True

The code revisions can be found below:

Module GeneralFunctions
Public Function GetPerson(ByVal PersonID As Integer) As Person
Dim GetPersonAdapter As New _PO_DataDataSetTableAdapters.PersonTableAdapter
Dim GetPersonTable As New _PO_DataDataSet.PersonDataTable
GetPersonAdapter.Fill(GetPersonTable)
Dim PersonDataView As DataView = GetPersonTable.DefaultView
PersonDataView.RowFilter = "ID = " + PersonID.ToString
With PersonDataView
If .Count > 0 Then
Dim objPerson As New Person
With .Item(0)
objPerson.ID = CType(.Item("ID"), Integer)
objPerson.FirstName = .Item("NameFirst").ToString.Trim
objPerson.LastName = .Item("NameLast").ToString.Trim
objPerson.HomePhone = .Item("PhoneHome").ToString.Trim
objPerson.CellPhone = .Item("PhoneCell").ToString.Trim
objPerson.Address = .Item("Address").ToString.Trim
If .Item("DateOfBirth").ToString > "" Then
'objPerson.BirthDate = CType(.Item("DateOfBirth"), Date)
objPerson.BirthDate = CType(.Item("DateOfBirth"), Date).Date
Else
objPerson.BirthDate = CType("1/1/1900", Date)
End If
objPerson.EmailAddress = .Item("EmailAddress").ToString.Trim
objPerson.Favorites = .Item("Favorites").ToString.Trim
If .Item("GiftCategories").ToString > "" Then
'objPerson.GiftCategories = CType(.Item("GiftCategories"), Integer)
objPerson.GiftCategories = .Item("GiftCategories")
End If
objPerson.Notes = .Item("Notes").ToString.Trim
End With
Return objPerson
Else
Return Nothing
End If
End With
End Function
07/05/2006