Board index » delphi » Listbox question

Listbox question

How do you return the index value for the selected item
in a listbox?

Ken
****************************************
An anti-spam email address has been used.
To return an email substitute the word
netmar where the word nospam occurs.

 

Re:Listbox question


Quote
Ken wrote:

> How do you return the index value for the selected item
> in a listbox?

ItemIndex.

A hint for future reference: go to the help on TListBox
(the most reliable way to do this is to drop a listbox on
a form and hit F1.) Now look at the descriptions of all
the Properties until you find the one you want. This
doesn't always work, but it works a lot of the time -
it would work for this question, for example.

--
David Ullrich

sig.txt not found

Re:Listbox question


Quote
Ken wrote:
> How do you return the index value for the selected item
> in a listbox?

Hello Ken,

here is example:

var
  i, total: integer;
begin
  Total:=0;
  for i:=0 to ListBox1.Items.Count - 1 do
    Total:=Total + StrToInt(ListBox1.Items.Strings[i]);
end;

==============================
Dusko Jovic
  d...@EUnet.yu

Other Threads