For i:=0 to ListBox1.Count-1 do
begin
if ListBox1.Items.Strings[i]='会计' then ListBox1.Items.Delete(i);
end;
但是delete后ListBox1.Count会变,导致出错,请问怎么删除ListBox1中值为“会计”的项?
begin
if ListBox1.Items.Strings[i]='会计' then ListBox1.Items.Delete(i);
end;
但是delete后ListBox1.Count会变,导致出错,请问怎么删除ListBox1中值为“会计”的项?
解决方案 »
- 各位老推荐些D7或d2010用的漂亮的新的皮肤类控件。
- delphi禁用全局shift键
- 神啊,救救我吧。adoconnection 从来没有出现过这种情况啊
- Delphi7中ADO连接Oracle问题~~
- 如何在保存文件的时候给文件定义一个默认的文件名啊,如hahh.jpg??
- 散尽所有分求解insert语句的问题!!!~~~~~~~~~~~~~~~
- 如何用Delphi做服务器?
- 灌水有理,我决定以后天天来灌水,同志来灌那
- 还是个老问题,在此自定义方法中如何避免创建多个窗体,是无模式窗口。
- 如何用readln函数一次只读出一行文本?????急!!!!!!!
- 用ADO控件访问access数据库。若access数据库设置密码,ADO控件将如何进行访问了?
- 急求用mscomm控件从modem中得来显的代码,我找了好多都不成功。
For i:=ListBox1.Count-1 to 0 do
begin
if ListBox1.Items.Strings[i]='会计' then ListBox1.Items.Delete(i);
end;
i:=0;
while i<ListBox1.Count do
if ListBox1.Items.Strings[i]='会计' then
ListBox1.Items.Delete(i)
else i:=i+1;
begin
if ListBox1.Items.Strings[i]='会计' then ListBox1.Items.Delete(i);
end;
ListBox1.Items.Delete(ListBox1.Items.IndexOf('会计'));