Re: Using the Delphi listbox

Posted by delphiman on November 22, 2005

In Reply to: Using the listbox please posted by Kibi on November 15, 2005

: How do you 'edit a listbox' and 'search a listbox'
: thank you :)

If by "edit" a Delphi listbox, you mean "change its contents" during runtime: the contents can be modified via its property "items":

- to add a line at the end:
ListBox1.Items.Add('This is a new line');

- to insert a line before the second line:
ListBox1.Items.Insert(1, 'Second line inserted');

- to remove first line:
ListBox1.Items.Delete(0);

- to replace a line with a new string:
ListBox1.Items[2] := 'Third line is replaced';

Related Articles and Replies


Delphi Forum