如何显示下一文件???(100分)

  • 主题发起人 主题发起人 兔爷
  • 开始时间 开始时间

兔爷

Unregistered / Unconfirmed
GUEST, unregistred user!
我想编一程序,用一个memo和一个button当我按一次button时,memo能自动<br>显示下一个文件的内容。我该如何做???请附例,谢谢!!!<br>
 
下一个文件?不明白。<br>应该还是用Memo1.Lines.LoadFromFile('C:/aa.txt');<br>
 
定义一个过程把它加到button的click事件中就好了。<br>var FSearchRec,DSearchRec:TSearchRec;<br>procedure TForm1.findfiles(APath:string);<br>var<br>&nbsp; &nbsp;FindResult:integer;<br>begin<br>&nbsp; &nbsp; &nbsp;findresult:=findfirst(Apath,faanyfile,fsearchrec);<br>&nbsp; &nbsp; &nbsp;try<br>&nbsp; &nbsp; &nbsp; &nbsp; while findresult=0 do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (fsearchrec.name&lt;&gt;'.')and(fsearchrec.name&lt;&gt;'..') then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; memo1.lines.loadfromfile(apath+fserachrec.name); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; findresult:=findnext(fsearchrec)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp;findresult:=findfirst(apath+'*.txt',fadirectory,dsearchrec);<br>&nbsp; &nbsp; &nbsp;while findresult=0 do<br>&nbsp; &nbsp; &nbsp; findresult:=findnext(dsearchrec);<br>&nbsp; &nbsp; &nbsp;finally<br>&nbsp; &nbsp; &nbsp; &nbsp; findclose(fsearchrec);<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>end;
 
接受答案了.
 
后退
顶部