关于Delphi如何读取.txt文件内容。。。。。。。

FormatJAVA 2008-01-17 12:41:23
现在我要做一个 PopupMenu 里面的item内容要在.txt文件里面读取。。。
但是我不知道我改怎么读取。。该怎么一行一行的读取。。。
那位大哥快告诉我谢谢。。
...全文
3258 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hong1168 2008-01-17
  • 打赏
  • 举报
回复
procedure TForm1.Button1Click(Sender: TObject);
var
myfile:Textfile;
s:string;
i,j:integer;
begin
Assignfile(myfile,'cell.txt');
Reset(myfile);
i:=0;
while not eof(myfile) do
begin
readln(myfile,s);
showmessage(s);
end;
end;
FormatJAVA 2008-01-17
  • 打赏
  • 举报
回复
谢谢 两位的帮助问题已经解决。。。
ideation_shang 2008-01-17
  • 打赏
  • 举报
回复
var
txtlist:TStringList;
i:integer;
begin
txtlist:=TStringList.create;
txtlist.LoadFromFile('d:\test.txt');
for i:=0 to txtlist.count-1 do
begin
showmessage(txtlist.strings[i]);
end;
end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧