我想保存一个文本文件,该文本文件的名称与edit1.text 关联
举例:
一个表单里只有一个button1,和edit1两个控件,我想问一下大家能不能实现procedure Tw_qzly.Button1Click(Sender: TObject);
var
str_detail:string; //数据内容
Mylist:TStringList;
i,j:integer;
begin
Mylist:=TStringList.create;
try
with ADOQuery1 do
begin
first;
for i:=0 to RecordCount-1 do
begin
str_detail:='';
for j:=0 to FieldCount-1 do
begin
str_detail:=str_detail+Fields[j].AsString;
if j<FieldCount-1 then
str_detail:=str_detail+'|'
else
if j=FieldCount-1 then
str_detail:=str_detail+'\n';
end;
Mylist.add(str_detail);
next;
end;
end;
finally
Mylist.SaveToFile('c:\s.txt');
Mylist.free;
end;
w_wlsz.Button2.Click;
end;
能不能把'c:\s.txt'中的's'用'edit1.text'来代替阿,有啥办法可以把文本文件保存为'c:\edit1.text.txt'
举例:
一个表单里只有一个button1,和edit1两个控件,我想问一下大家能不能实现procedure Tw_qzly.Button1Click(Sender: TObject);
var
str_detail:string; //数据内容
Mylist:TStringList;
i,j:integer;
begin
Mylist:=TStringList.create;
try
with ADOQuery1 do
begin
first;
for i:=0 to RecordCount-1 do
begin
str_detail:='';
for j:=0 to FieldCount-1 do
begin
str_detail:=str_detail+Fields[j].AsString;
if j<FieldCount-1 then
str_detail:=str_detail+'|'
else
if j=FieldCount-1 then
str_detail:=str_detail+'\n';
end;
Mylist.add(str_detail);
next;
end;
end;
finally
Mylist.SaveToFile('c:\s.txt');
Mylist.free;
end;
w_wlsz.Button2.Click;
end;
能不能把'c:\s.txt'中的's'用'edit1.text'来代替阿,有啥办法可以把文本文件保存为'c:\edit1.text.txt'
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货