It would be a lot easier if you were working with objects. Examle if you
have a Person class having all the necesary properties, then you would
override ToString() method of your Person class. Then all you need to do is
add the instance of Person to the .Items collection of listbox (ie:
listBox1.Items.Add(person1) ).
Then by grabbing all the selected items from your first list box, you can
add them to you second listbox ie
(listBox2.items.AddRange(listbox1.SelectedItems); ) And when you need to
update your database, you can cast the objects back to Person type, which
will give you all the properties of the object.
hope this helps
Fitim Skenderi
<ma***********************@fujifilmsericol.comwrot e in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi all,
I'm trying to add functionality to an app written in C# so that a list
of people is displayed in a list box on the left hand side and then
selected individuals can be added to another list box on the right-hand
side.
I've got the data from my database into a database reader and I can get
it into an arrayList, however I can't get it to do what I want! :)
Basically, I want to use the unique index of my database as the index
for the list boxes, so that I can add a unique ID to the listBox with
an assigned value, the value can be selected, transfereed to the second
Listbox (along with it's value!) and then the database can be updated
accordingly.
Any advice is welcome,
Cheers,
Matt