//很菜的一个问题(10分)

  • 主题发起人 hurryman
  • 开始时间
H

hurryman

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.ListBox1Click(Sender: TObject);
var i:integer;
begin
for i:=0 to listbox1.Items.Count-1 do
begin
if listbox1.Selected then
listbox1.Items.Delete(i);
end;
end;
//为什么不能删除,而且老提示越界
 
listbox1.Items.clear
 
老兄:
谢谢
listbox1.Items.Delete(i);
我是要删除我所选的那个呀
 
procedure TForm1.ListBox1Click(Sender: TObject);
var i,j:integer;
begin
j:=listbox1.Items.Count-1;
for i:=j downto 0 do
begin
if listbox1.Selected then
listbox1.Items.Delete(i);
end;
end;
因为listbox1.Items.Count随着你的删除是一直在变小的
 
多人接受答案了。
 
顶部