Wrox Programmer Forums
|
BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8
This is the forum to discuss the Wrox book Wrox's Visual Basic 2005 Express Edition Starter Kit by Andrew Parsons; ISBN: 9780764595738
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's Visual Basic 2005 Express Edition Starter Kit ISBN: 978-0-7645-9573-8 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 March 4th, 2008, 06:24 PM
Registered User
 
Join Date: Mar 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 - Try it out "Adding a database..."

I am absolutely stuck on this chapter. I followed every step in the book and I still can not get my DB info to show on the PersonList control.
I reviewed the Errata for this chapter, but it is not my case, the connecting string does match with my database.
I even created a new application ad tried to do the same on a listBox in the main form and it works just fine. Then I created a UserControl with a listbox and a button + handler to call the control and Ooops!... failed again.

It there a bug in this operation?... is there any additional code/configuration to twick a UserControl to get this to work?

If any one knows the answer, please help!!!!

 
Old March 6th, 2008, 01:12 PM
Registered User
 
Join Date: Mar 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the answer to my dilemma!

When a database table is dragged into a control (like a list box), the binding is automatically setup by VB for the control, but the command line (in this case I am working with the "Person" table from DB "PO Database"):

     Me.PersonTableAdapter.Fill(Me._PO_DataDataSet.Pers on)

is created on the main form only, so whenever this method is used on a UserControl (like the Personlist.vb), that line must be present on the "Load" sub for the control itself, otherwise the binding will not work:

Public Class PersonList

    Private Sub PersonList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.PersonTableAdapter.Fill(Me._PO_DataDataSet.Pers on)

   End Sub

I hope this helps if You got stock with the same problem!!
End Class






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 - Extra Credit Code [Adding To Database] lcoon BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 1 November 15th, 2009 03:00 AM
Chapter 1 - Getting Started - Adding Connection roscoe BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 6 November 6th, 2006 05:03 AM
Chapter 2: Adding Arrays Invincible Pear BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 January 2nd, 2006 07:25 AM
Chapter 1 - Adding PHP to the Equation Chudz BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 June 27th, 2005 06:21 PM
Chapter 1 - Adding PHP to the Equation Chudz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 7 June 22nd, 2005 11:32 AM





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