Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7
This is the forum to discuss the Wrox book Beginning Microsoft Visual Basic 2008 by Thearon Willis, Bryan Newsome; ISBN: 9780470191347
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 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 December 2nd, 2009, 07:55 AM
Registered User
 
Join Date: Dec 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Unhappy Chapter 5 Question

Built the example code in Chp 5 fine but after running it and attempting to use the "Delete Customer" button, I get an ArgumentException with the message "Cannot remove the specified item because it was not found in the specified Collection." In viewing the contents of "objCustomers" or "oldCustomer" is lists "Nothing" for the fields. Anyone else have an issue with this or have an idea of what my issue is likely caused by? Seems to me that during the SelectedCustomer property, nothing is getting returned.

Driving me mad!
Reply With Quote
  #2 (permalink)  
Old December 2nd, 2009, 04:18 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Have you downloaded the code for the book and compared the code for this exercise to your code?

Give that a try. It sounds like you might have missed a step somewhere along the way.

Thearon
Reply With Quote
The Following User Says Thank You to Thearon For This Useful Post:
jltscaa (December 3rd, 2009)
  #3 (permalink)  
Old December 3rd, 2009, 06:46 AM
Registered User
 
Join Date: Dec 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Duo!

Don't know how - maybe too early in morning - missed the line for "objCustomers.Add(objNewCustomers)". Thanks for the suggestion - loving the book!
Reply With Quote
  #4 (permalink)  
Old February 28th, 2010, 11:51 PM
Registered User
 
Join Date: Feb 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 code

Quote:
Originally Posted by jltscaa View Post
Built the example code in Chp 5 fine but after running it and attempting to use the "Delete Customer" button, I get an ArgumentException with the message "Cannot remove the specified item because it was not found in the specified Collection." In viewing the contents of "objCustomers" or "oldCustomer" is lists "Nothing" for the fields. Anyone else have an issue with this or have an idea of what my issue is likely caused by? Seems to me that during the SelectedCustomer property, nothing is getting returned.

Driving me mad!
I had a similar experience and came to the same conclusion. I was able to get things to work by adding an Item property with an index parameter to the CustomerCollection Class.

Code:
Default Public Property Item(ByVal index As Integer) As Customer
        Get
            Return CType(List(index), Customer)
        End Get
        Set(ByVal value As Customer)
            List(index) = value
        End Set
    End Property
I changed the SelectedCustomer property as follows:

Code:
 Public ReadOnly Property SelectedCustomer() As Customer
        Get
            If lstCustomers.SelectedIndex <> -1 Then
                Return objCustomers.Item(lstCustomers.SelectedIndex)
            End If

        End Get
I was unable to detect any difference between my code, before these changes, and the downloaded code.

I hope this helps.
Reply With Quote
  #5 (permalink)  
Old March 1st, 2010, 02:18 AM
Registered User
 
Join Date: Feb 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 - Oops!

My apologies. I seem to have skipped two full pages. The code it took quite a bit of time in help to figure out was right there in the book. I guess it was too early in the morning for me, too.
Reply With Quote
  #6 (permalink)  
Old March 1st, 2010, 11:06 AM
Registered User
 
Join Date: Dec 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Vis B.net

Question.
With XP comes Microsoft Works, there is a section called Data Base.
If you fill the data base with only the stuff you need to complete a project.
How do you connect to it considering it is internal, my Vis B is on the same machine.
This is self contained and not involving SQL etc.

cheers.
Reply With Quote
  #7 (permalink)  
Old May 18th, 2010, 09:39 PM
Authorized User
 
Join Date: May 2010
Location: Phoenix, AZ
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by solacunis.h View Post
Question.
With XP comes Microsoft Works, there is a section called Data Base.
If you fill the data base with only the stuff you need to complete a project.
How do you connect to it considering it is internal, my Vis B is on the same machine.
This is self contained and not involving SQL etc.

cheers.
Regarding connecting with a Microsoft Works Database (*.wdb), there isn't really a clean way to do this. I tried playing with this some time ago, and the challenge I ran into was that I couldn't find a database driver or a data provider for Works database files.

Just a few thoughts...

I understand you don't have Access, so what you might try and do is export the *.wdb file as a flat *.csv file, and then import that into SQL Express (free).

You can create an ODBC connection to a *.csv or *.txt file by creating an ODBC connection with the Microsoft Text Driver. With that, there is a System.Data.ODBC database connection method in Visual Studio, which you could use to then tap into that *.csv file.

If you plan on using smaller databases, it might be worth the investment in Access, or maybe better, a Microsoft TechNet subscription (Windows and Office), or a pricier an MSDN subscription (Windows, Office, Visual Studio).

A bit more complicated, and certainly way more involved: you can create a blank Access *.mdb file when trying to create an Access ODBC connection within Windows (Control Panel, Administrative Tools, Data Sources, System DSN, Add, Microsoft Access Driver, Finish, Create...). If you created a blank Access file, you would then need to build an application in Visual Studio to populate the database (I know, ouch!).
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
Chapter 5 Question 5 Will BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 October 24th, 2009 10:18 AM
Question on Chapter 5 arholly BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 September 2nd, 2008 05:07 PM
Chapter 4 question davidle1234 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 18th, 2007 12:18 AM



All times are GMT -4. The time now is 10:20 PM.


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