我 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.
但始终有错 ,该如何改动
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.
解决方案 »
- listindex out of bounds
- 請教一個sql語句問題關于replace
- 四月的Borland,又走失一员大将,风雨飘摇的Delphi还能浴火重生吗?
- 求高手帮忙看看这个sql语句,看能不能提高速度!
- 毕业设计 课题是分布式售票管理系统 请大家提供思路!非常谢谢大家!!
- 如何原样导出dbrid的数据到excel
- win2003下sql脚本加入delphiIDE中汉字变成问号.
- 显示JPEG时出错,请大家帮忙,在下先谢谢各位!
- Kylix编译的文件怎样直接运行?
- Delphi里能显示DWG(autocad文件)图形吗?
- 如何將一個字符串數組的空值過濾掉?將非空的數組元素值重新排序?
- 打开EXE文件报错: 类没有注册,急!!!!!!
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;
================================
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.