Computing.Net > Forums > Programming > Delphi Listbox (simple question)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Delphi Listbox (simple question)

Reply to Message Icon

Name: Peter K.
Date: June 5, 2003 at 07:14:39 Pacific
OS: winxp
CPU/Ram: pIII 866/512mb
Comment:

Hello
I have a listbox in Delphi. With a few entries in it. How can I read out the first entry, how the second...and so on?
X:=listbox1. ...?

If the listbox was an edit field:
X:=edit1.text;

I have no idea :)
Thanks!!!



Sponsored Link
Ads by Google

Response Number 1
Name: micah
Date: June 5, 2003 at 10:53:03 Pacific
Reply:

I'm just going to take a guess at this cause I haven't used Delphi. But, try this:

Do some sort of loop and increment an integer by one. Then:

X:=listbox1.List(i)

Or...something like that:þ

-Micah


0

Response Number 2
Name: magpie
Date: June 5, 2003 at 20:42:24 Pacific
Reply:

Try this

X:=ListBox1.Items[i];

where i is in the range of 0 (first item in list to ListBox1.Items.Count-1.

Note ListBox1.Items.Count gives the number of items in the list (say 10), but since the first item in the list is referenced as 0, the last item in the list is referenced as 9.

AJS


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Delphi Listbox (simple question)

Simple C++ Question www.computing.net/answers/programming/simple-c-question/4449.html

Listbox, Task Viewer www.computing.net/answers/programming/listbox-task-viewer/14877.html

C Program Simple Question (HELP...) www.computing.net/answers/programming/c-program-simple-question-help/10559.html