请高手过来看看我的代码!谢谢
该程序是把文路径添加到一个列表listbox 中,第一次,第二添加的时候正确
如果你多添加几次,所添加的项目将是以上添加的平方倍,不知道为何?
请高手指导:你只要添加4 个控件就可以-- directorylistbox,drivecombox,button
listbox;
procedure TautoDelform.ButtonClick(Sender: TObject);
var
i:integer;
filestr:string;
begin
timer1.Enabled:=false;
filestr:=DirectoryLb.Directory;
if listbox1.Items.count=0 then
ListBox1.Items.add(filestr)
else
begin
for i:=0 to (ListBox1.Items.Count-1) do
begin
if(ListBox1.Items[i]=filestr) then
Exit
else
ListBox1.Items.add(filestr);
end;
end;
end; // if