• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Obtain value from listbox

I have a form with a listbox (list0) that stores usernames belonging to a specified global group, using Active Directory's LDAP function.

Once I double-click an item in the listbox, I need to store the value not the index for later use. For example, the first value in list0 is "Homer Smith", I need to capture "Homer Smith" instead of 0.

Sorry, but i'm limited on points
0
wilsonjj
Asked:
wilsonjj
1 Solution
 
twalgraveCommented:
if list1.listindex > -1 then
 msgbox list1.list(list1.listindex)
endif
0
 
luisseixasCommented:
 Hi Wilson.

  Doing this, you’ll have to run through all your list items, but I guarantee you it is fast and it works very well.



procedure TForm1.List0DblClick(Sender: TObject);
var i: Integer;
begin
  For i:=0 to List0.Items.Count-1 do
    If List0.Selected[i]
      then Edit1.Text:=List0.Items.Strings[i]
end;



See ya!
0
 
FaithRavenCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept twalgrave's comment
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

FaithRaven
EE Cleanup Volunteer
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now