下面错误显示ListBox1Add是个未定义的标示符,显然你点打错位置了,应该在add前面。
解决方案 »
- 带有dvExpress控件的程序如何从7升级到2010
- 如用用FastReport根据DataGrid动态生成报表?
- 谢谢各CSDN网友,散分ing...
- 高中毕业生最好不要来湖南大学
- 在线等待:开始菜单和系统栏上快速启动栏的handle是什么??
- b/s 结构版本及时更新问题
- 送分,一个简单的问题,关于asciitoint函数(抢分)
- delphi7 access adoquery 分段累加求和。
- IdUDP出错,求指导
- 如何通过ODBC用Delphi或其它编程语言向Excel工作表中添加数据
- 一个画图程序,没有思路,恳求大神支招
- delphi里怎么把指定文件夹内的所有文件名输出出来(重不重复无所谓,类型也无所谓)
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
Memo1: TMemo;
OpenDialog1: TOpenDialog;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}function searchfile(path:string):TStringList;
var SearchRec:TSearchRec;
found:integer;
list:TStringList;
begin
list:=TStringList.Create;
found:=FindFirst(path+'\*.*',faAnyFile,SearchRec);
while found=0 do
begin
if (SearchRec.Name<>'.') and (SearchRec.Name<>'..') and (SearchRec.Attr<>faDirectory)
then List.Add(SearchRec.Name);
found:=FindNext(SearchRec);
end;
FindClose(SearchRec);
searchfile:=list;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines:=searchfile(Edit1.Text);
end;end.上述代码,已经修改,并执行通过。目录录入Edit1.Text中。搜索的文件,存入Memo1。