Use listbox with SQL table data to fill remaining form controls upon selection

I have an SQL table, (tblFPDetail), that I would like to retrive data from and display this information in several textboxes on my form. My table has a foreign key (PCIDNum) with another table,(PCinfo). The PCInfo table contains a field, PCName. I would like to be able on my form to have a listbox that shows the PCName values of which the user would select the appropriate one. The remaining textboxes on the form would then fill with the related data from tblFPDetail. The user should then be able modify the values within the textboxes with data from tblFPDetail and select save from the toolstrip and have the values within tblFPDetail be modified.
Thanks in advance for any help!
IronDriverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
IronDriver,

You understand that what you are asking needs a lot of code to do. I will show you the basics and you can start working with that but it's difficult to explain everything in a post. I will show you how to retrive data from the form and populate the listbox (in the example I use a listview) but you can use that. Check this example that I post it yesterday http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_Studio_.NET_2005/Q_23111538.html

Then what you have to do is when the user change the selection on the listview (listview selectedindexchange event) you read again from the db and populate the textboxes.

You can also use a datagridview control and bind using the available wizards. With this you can update/delete and insert direcly in the datagridview.
0
IronDriverAuthor Commented:
Thank you jp for the response...sorry so long to follow up. It has taken me a little while to actually get this to work as you have referenced in some of your prior comments. I have gotten the listview to work fine but that is about half the battle. I have included a diagram in PDF format the better illustrates what I am looking for. I may be headed about this in the wrong manner and if so feel free to let me know a simpler way...or if I am just wayyyyy off.   Thanks!
Simple-Table-Diagram.pdf
0
Jorge PaulinoIT Pro/DeveloperCommented:
HI,

I have seen you Diagram but if you already filled the list the you can do the next step. When you populate a listview you should include a column with the ID. When you select the ID on the listview you do a select statement to the database and populate the fields. This is almoust the same as populate the listview but since it will retrieve only one field you will set the fields to the form textboxes.

After this you only need to build a update statement and save the data to the database.

I don't know wath you have so far and your dificulties so it's better if you expose them and show what you have so far.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.