|
-
Feb 10th, 2012, 01:11 PM
#1
Thread Starter
New Member
listbox row selected
I've being trying to work out a problem i've being having for a while now and i'm not sure if i'm over complicating it.
When a form loads, it uses a for next loop to load an array of peoples names into a list box. However i want to extract the persons ID once their name has being clicked. I can make this work by using another for next loop until the selected name matches the an array number. However it fails if there are two people of the same name.
Is there a command or piece of code that can extract the row number of the item selected?
This problem has being bugging me for weeks now and any help would be much appreciated.
-
Feb 10th, 2012, 01:42 PM
#2
-
Feb 11th, 2012, 09:00 AM
#3
Thread Starter
New Member
Re: listbox row selected
Aah i think i misused this when i tried it the first time. Thanks ever so much, finally fixed that little use.
-
Feb 11th, 2012, 12:17 PM
#4
Re: listbox row selected
Another option would be to use databinding. If you were to have a datatable with the name and id, you could bind the listbox to the table and set the DisplayItem to the name and the ValueItem to the ID. Then you could get either part from the listbox. However, it sounds like you have two distinct arrays for the two pieces, in which case you can't bind to both.
My usual boring signature: Nothing
 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|