首先用OpenDialog多选选择多个文本文件到
Listbox1中,问题就是这里,选择一项之后就自然将这一项的内容读取到Listbox2中,怎么解决??
 
感谢大家了。

解决方案 »

  1.   


    procedure TForm1.ListBox1Click(Sender: TObject);
    var
     i:integer;
    begin
      for i:=0 to ListBox1.Items.Count-1 do
       begin
        if Listbox1.Selected[i]  then
         listbox2.Items.Add(Listbox1.Items[i]);
       end;
    end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if OpenDialog1.Execute then
    listbox1.Items:=OpenDialog1.Files;
    end;
      

  3.   


    if OpenDialog1.Execute then
     begin
       ListBox3.Items.LoadFromFile(OpenDialog1.FileName); 
       ListBox1.Items.AddStrings(ListBox3.Items);
     end;