Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 by Thearon Willis, Bryan Newsome; ISBN: 9780764574016
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 30th, 2007, 09:23 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default (Collection) appears in the list box

I don't know if this is the correct forum for: 0-7645-7401-9 Wrox Beginning Visual Basic 2005.
If it is not can anyone direct me to the correct forum?
If so: Working with Structures page 150-152:
"(Collection)" appears 3 times in the list box instead of the Customer Entries.
I think I have typed the "Try It Out Using an ArrayList" as the book describes.
Can anyone show me were I am in error?
Thanks, Tracey
MSVS2005 Pro AE on Win2K.
ISBN: 0-7645-7401-9 Wrox Beginning Visual Basic 2005.
BTW:
I had to comment out objNewCustomers.Add(objCustomers): 'Add' is not a member of 'StructureDemo.Customer'
... and ...
Try It Out (Overriding ToString) on page 152 does NOT resolve/change anything:
Public Overrides Function ToString() As String
  Return Name & " (" & Email & ")"
End Function


Form1.vb
Public Class Form1
  Private objCustomers As New ArrayList
  Public Sub CreateCustomer(ByVal firstName As String, ByVal lastName As String, ByVal email As String)
     Dim objNewCustomers As Customer
     objNewCustomers.FirstName = firstName
     objNewCustomers.LastName = lastName
     objNewCustomers.Email = email
     'objNewCustomers.Add(objCustomers)
     lstCustomers.Items.Add(objCustomers)
  End Sub
  Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
     Dim objCustomer As Customer
     objCustomer.FirstName = "Michael"
     objCustomer.LastName = "Dell"
     objCustomer.Email = "mdell@somecompany.com"
     DisplayCustomer(objCustomer)
     CreateCustomer("Darrel", "Hilton", "dhilton@somecompany.com")
     CreateCustomer("Frank", "Peoples", "fpeoples@somecompany.com")
     CreateCustomer("Bill", "Scott", "bscott@somecompany.com")
  End Sub
  Public Sub DisplayCustomer(ByVal customer As Customer)
     txtName.Text = customer.Name
     txtFirstName.Text = customer.FirstName
     txtLastName.Text = customer.LastName
     txtEmail.Text = customer.Email
  End Sub
End Class

Customer.vb
Public Structure Customer
  Public FirstName As String
  Public LastName As String
  Public Email As String
  Public ReadOnly Property Name() As String
     Get
        Return FirstName & " " & LastName
     End Get
  End Property
  Public Overrides Function ToString() As String
     Return Name & " (" & Email & ")"
  End Function
End Structure
__________________
Tracey
Reply With Quote
  #2 (permalink)  
Old April 30th, 2007, 09:53 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
Default

I discovered a type-o

I guess I had to walk away and do something else in order to clear my mind.

Tracey

Tracey
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reporting Services Login box appears zulf BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 6 August 30th, 2011 06:16 AM
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 02:04 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM



All times are GMT -4. The time now is 08:15 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.