在ListBox1中的内容按住Shift或Ctrl键,选择多个ListBox1中的内容,再添加到ListBox2中。
请教,怎么实现?

解决方案 »

  1.   

    MultiSelect := True;
    for i := 0 to ListBox1.Items.Count-1 do
      if ListBox1.Selected[i] then ListBox2.Items.Add(ListBox1.Items[i]);
      

  2.   

    献丑了~~~~~~~~~~
    listbox中有个属性:multiselect,将它设置为true,就可以多选了
    至于添加unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        ListBox1: TListBox;
        ListBox2: TListBox;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      I:word;begin
    I:=0;
    for I:=0 to listbox1.Itemindex do
      if listbox1.Selected[i] then
      begin
        listbox2.Items.Add(listbox1.Items.Strings[i]);  end;
    end;end.
      

  3.   

    (1)MultiSelect := True;
    (2)var
         i: integer;
       begin
         for i := 0 to ListBox1.Items.Count-1 do
           if ListBox1.Selected[i] then 
              ListBox2.Items.Add(ListBox1.Items[i]);
       end;
      

  4.   

    楼主没事做吗??同样的问题问了三遍!
    http://community.csdn.net/Expert/topic/3591/3591531.xml?temp=.6054193;
    http://community.csdn.net/Expert/topic/3590/3590004.xml?temp=3.788394E-02;
    http://community.csdn.net/Expert/topic/3588/3588621.xml?temp=.8432581
      

  5.   

    To:coeltdit(睫毛上的冰)
    呵呵~~~!!!
    不是啊!
    献丑了!本人脑袋不是很灵啊!献丑。献丑。献丑、
      

  6.   

    To:coeltdit(睫毛上的冰)
      我好像试过啊!MultiSelect := True;但是按住Shift或Ctrl都不行啊!
      顺便再帮我个忙:
    Project ConsumeApp.exe raise exeception class EOleException with message 'ERROR:parser error at or near "form"'.process stopped;
    到底是哪里出问题了?
      

  7.   

    From写成了Form???是不是SQL语句有问题,  单步执行看看;  你的SQL SERVER是英文版?
    -----------------------------------------------------------------------------------------
         MultiSelect := True  是一定可以的