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 April 27th, 2007, 11:39 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Anyone help me out here?

I have an Access database with 3 tables... Cat, SubCat, and Links.

Cat is as follows:
autCatID (autonumber)
txtCatName (text)

SubCat is as follows:
autSubCatID (autonumber)
intSubCatParent (integer, contains the appropriate number from Cat.autCatID)
txtSubCatName (text)

Links is as follows:
autLinkID (autonumber)
intLinkParent (integer, contains the appropriate number from SubCat.autSubCatID)
txtLinkName (text)
txtLinkURL (text)

My form has three ListBoxes, Cat, SubCat, and Links. You can guess what data goes in them! My problem is that I can't figure out how to bind the data to the controls. I need it so that Cat shows all data from Cat table, but when an item is clicked, it displays the relevant data from the SubCat table. Same goes for Links, where it has to show relevant data from Link table.

I can't for the life of me work out how to bind the data using the supplied GUI. I can do this easily under VB6 - I just use CreateObject and supply SQL statement using the ListBox data. I can't do this under VB 2005. What a step backwards this P.O.S is.

 
Old April 27th, 2007, 11:47 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I can't do this under VB 2005. What a step backwards this P.O.S is.
People fear that which they don't understand.

http://www.knowdotnet.com/articles/differences.html <--this will be most helpful comparission of VB6 to .NET
http://www.codeproject.com/vb/net/da...ngconcepts.asp
http://www.developer.com/net/vb/article.php/3558771

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 27th, 2007, 11:53 AM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, those links offered very little.

I do understand databinding. I just can't figure out a way to do what I said above. All the examples I can find seem to end up with something that looks like Microsoft Access in form view, and all I want to do is be able to run a few queries on the database and show the ListBox data accordingly.
 
Old April 27th, 2007, 12:02 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Loop through your data source and do:

VB
Me.ListBox1.Items.Add([value])
C#
this.listBox1.Items.Add([value])


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 27th, 2007, 12:07 PM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Loop using which method? I'm trying to do it via the Data Manager within VB 2005. I have no problem binding the data to each ListBox, but need it to update each ListBox according to what is selected in the previous ListBox.

I need each item in the ListBoxes to have their ValueData set, so as it loops through, it assigns the autID's to the ValueData, and the txtName's to the DisplayData, so I can use the selected ValueData as arguments for future referencing when updating the other ListBoxes, if there is a way of doing that.

Honestly, its such a simple task, and yet its not obvious how its done under VB 2005.

 
Old April 27th, 2007, 12:19 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Using the Data Manager, I am unsure of as I don't use it. Brian, Peter or Gonzalo may be able to better help you if they stumble across this post.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 27th, 2007, 12:47 PM
Authorized User
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

Here are two MSDN links that may help:

http://msdn2.microsoft.com/en-us/library/ms171912(VS.80).aspx

http://msdn2.microsoft.com/en-us/library/57tx3hhe(VS.80).aspx

The 2nd link deals with displaying related data on a form.




Best Regards,
Earl Francis









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