怎么把LISTBOX1里面的内容移到LISTBOX2里面。怎么写?

解决方案 »

  1.   

    procedure TForm1.btn1Click(Sender: TObject);
    var
       i: Integer;
    begin
      For i := 0 to lst1.Count - 1 do
      begin
        lst2.Items.Add(lst1.Items[i]);
      end;
    end;
      

  2.   

    ListBox2.Items := ListBox1.Items;
      

  3.   

    ListBox2.Items.Assign(ListBox1.Items);
      ListBox1.Items.Clear;
      

  4.   

    procedure Tfrmfood_out.Button4Click(Sender: TObject);
    begin
      while listbox2.ItemIndex>-1 do
        begin
          listbox1.Items[listbox1.Items.Count]:=listbox2.Items[listbox2.itemindex];
          listbox2.DeleteSelected;
        end;
    end;
    将listbox1中的选中项添加到listbox2中。
      

  5.   

    Delphi syntax:procedure MoveSelection(Destination: TCustomListControl); virtual;C++ syntax:virtual void __fastcall MoveSelection(TCustomListControl* Destination);DescriptionCall MoveSelection to copy all selected items to another list control and then delete them from this list control.