Re: Using the Delphi listbox

Posted by delphiman

In Reply to: Using the listbox please posted by Kibi

: 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


DelphiLand Discussion Forum