Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2008, 09:30 AM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Databinding to a Listbox


I have VB 2005 Express Edition Starter Kit by Andrew Parsons ISBN 0-7645-9573-3. In chapter 7 on page 126 there is a try it out and it shows to drag and drop a table from a datasource onto a listbox and when you run the program it is supposed to show the first column that is not an autonumber. The listbox properties changed to reflect the drag/drop operation. The Value Member property changes to ID and the Display Member property changes to NameFirst. I run the program and it runs without error, however it does NOT show the information. If I look at the database in the database explorer the data is shown. The errata for the book references a connection string issue but is not clear on how to fix it. I think it has to do with the database being created in a different project and then being added to the current project. This is a .mdf file, not a SQL connection.

Any help is appreciated.
-Rich
 
Old June 1st, 2008, 04:59 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have solved this myself. It was a simple matter of one line of code. When doing the drag/drop operation on a listbox that is directly on the main form (not a custom user control) a line of code gets added to the form load event to fill the table adapter from the dataset. When you drag/drop this to the user control it does not automatically add that line of code to the load event of the user control. When I manually added that line of code the program worked as expected.

I will submit this as errata.

-Rich





Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
Webform listbox databinding to any property Rachel P VS.NET 2002/2003 0 October 1st, 2005 10:11 PM
format and databinding marclena VS.NET 2002/2003 1 February 11th, 2004 09:11 PM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.