我 form中两个listbox 两个按钮 实现可以单选和全选将listbox1中数据到listbox2中;
但始终有错 ,该如何改动
procedure TForm_del.Button1Click(Sender: TObject);
var i:integer;
begin
for i:=0 to lb1.Count-1 do
begin
if lb1.Selected[i] then
lb2.Items.Add(lb1.Items[i]);
end;
next;
end;
procedure TForm_del.Button2Click(Sender: TObject);
var i:integer
begin
for i:=0 to lb1.Count-1 do
begin
lb2.Items.Add(lb1.Items[i]);
end;
next;
end.

解决方案 »

  1.   

    next;干什么用的?哪里来的?
      

  2.   

    建议弄基本书看看procedure TFrmMain.Button1Click(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;procedure TFrmMain.Button2Click(Sender: TObject);
    var
      I: Integer;
    begin
    for i:=0 to ListBox1.Items.Count-1 do
    begin
    ListBox2.Items.Add(ListBox1.Items[i]);
    end;
    end;
      

  3.   

    楼主我是来拿分的,你看这好像是你要的哦
    ================================
    Moves all selected items to another list control.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.