Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Collections, Listboxes etc

Status
Not open for further replies.

Lenvdb

Programmer
Jun 21, 2002
81
GB
Heya Gurus...
I miss the days when...
Remember in VB6 when one would have 2 Listboxes on a Form?
There would be arrow buttons >> or << between the 2 Listboxes and you populated the 1st Box with the content of a Lookup table, using a query, and the ID field of the table was the ItemData key which you would place ins1de the Listindex. Then, as you selected an item from the listbox on the left, you would click on the >> button to add it to the listbox on the right. In the end, once you added all the items you could then save the items on the right as values in another table with an Update/Insert query?

Now we are in VB.net and you no longer have ItemData. You have to bind the silly Listbox using the DisplayMember and ValueMember. And the Values I selected on the left now are placed in a Collection as they enter the Listbox on the right. So the Listbox on the right is bound to the Collection. But say you made a mistake and selected an item in error and now you need to remove it from the Listbox on the right? You would need to modify the underlying Collection object to remove the Selected Item in the Listbox, then re-set the Data Source of the Listbox to be the Collection again.

And this is where I get stuck. How do I do this?
Remember I still need to keep the ItemID's as I need to save them to another table on some other button's click event.

Does anyone have a magic wand for me?
B-)

Len
 
Thanks to all of you for your wonderful response.
I was driven to tears by your overwhelming enthusiasm.

To those of you who guided me I am sincerely grateful.
I created a class that would add my own ItemData Property and it works like a charm.

Now I CAN HAVE Itemdata values.

Thanks you once again.

Len

Quiet as a bulldozer Mate!
 
Hi Len,
I just joined this forum. I share your frustuations with respect to VB.net verus VB. I am very new to VB.net platform. Is there any source you could lead me to so that I can have a jum start on things with VB.net. The transition seems difficult. I am looking for something that shows how things were done in the old VB and how they are done in VB.net. And something that covers pretty everything. I am familiar with the concept of OOP.
I am deseprate as I have to upgrade an MS access Front end to VB.net. The back-end has been upgraded to SQL Server with no problem.
Thank you so much in advance
Bensta
 
Heya Bentsa

There is no way to upgrade Access Front ends...
I walked the same road.
I am rewriting the app in VB.net instead...
Get a good book or 2 , do acourse and check out these forums.

Somewhere along the lines someone invented a wheel already and you won't need to reinvent it.

Good luck mate!



Quiet as a bulldozer Mate!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top