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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting value from a list box

Status
Not open for further replies.

afryer

Programmer
Mar 9, 2004
207
GB
Hello everyone,

I have a list box in Delphi and I need to know how to extract the value. I can get the ListIndex property to get the position in the list that is selected, but I have no idea how to extract the relavent values selected from the list.

Any help would be appreciated as I am very new to Delphi.

Andrew
 
Hi Andrew,

it's not listindex but itemindex. to get the current selected item do this :

Code:
 if ListBox1.ItemIndex > -1 then // always check if something is selected
  Mystring:=ListBox1.Items[ListBox1.ItemIndex];

cheers

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top