• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

2 Listboxes

Hi all,

Should be an easy question. I have 2 listboxes on my form. What I am trying to do is the following. I am reading data from my serial port and adding it to listbox1 but I need to "pause" it some times so I have an invisible listbox2 also to which the data is then directed when in "paused" state. So how do I append all the data from listbox2 into listbox when "unpaused"?
0
DigitalNam
Asked:
DigitalNam
  • 2
  • 2
1 Solution
 
Mechanic_KharkovCommented:
Listbox1.Items.BeginUpdate;
Listbox1.Items.AddStrings(ListBox2.Items);
ListBox1.Items.EndUpdate;

;-)
0
 
DigitalNamAuthor Commented:
Hehehe thanks Mechanic Kharkov... works like a charm. Thanks for the quick response.
0
 
Mechanic_KharkovCommented:
Not at all. And one more thing: You don't need to use hidden listbox, just use TStringList to collect lines. E.g.:

var ReservedList: TStringList;

begin
 ReservedList := TStringList.Create();
try
   ... //use it
finally
  ReservedList.Free;
end;
end;

This list is the same as TListbox.Items. You can Clear it, Add, AddStrings, and so on. But it has no visual representation on your form. You can create it in FormCreate method and free in FormClose as well.
0
 
DigitalNamAuthor Commented:
Thank you for the suggestion.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now