Hi i just want to know how can i display the item i selected in a listbox into a memo?

Example :
I selected in my listbox Item : Banana
When i click it in the listbox, Banana will be added in my memo.

thank you

Recommended Answers

All 3 Replies

Hi
You cane write this procedure for OnClick Event of ListBox

procedure TForm1.ListBox1Click(Sender: TObject);
Var
    I:Integer;
begin
    For I:=0 to ListBox1.Items.Count-1 Do
        If ListBox1.Selected[I] then
            Memo1.Lines.Add(ListBox1.Items.Strings[I]);
end;

thank you very much! it's working! :)

Avoid cycles. Can simplify:

Memo1.Lines.Add(ListBox1.Items.Strings[ListBox1.ItemIndex]);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.