如何动态创建edit并保存edit中的内容为txt文档啊。。
解决方案 »
- 问个一直很困惑的问题
- 可以给DBGrid指定行和列付值吗
- 三層問題?????
- 为什么不捕捉VK_ESCAPE键?
- 本公司诚聘数据库程序员加盟--中国东莞
- 有没有对SQL 语句进行自动优化的软件
- 再开一贴,求局域网的QQ怎么才能上线的方法?
- 数据保留小数以及文件存盘的问题
- 求助:关于delphe无法在vista下运行
- funcition里的result可不可以返回两个值?????????
- try...except....结构中,如果发生异常,执行完except中的语句后,还会不会执行下面的语句?
- 特别感谢大龙和艺人还有halfdream(哈欠) 对我的股票读取数据转换的帮助,请三人来接余下的100分
edit1 := Tedit1.create
edit1.text := ....;
操作文件
var
TextFileVar: Text ;
assignfile(TextFileVar , FileName )
rewrite//为写创建文本文件
....
就是对文件的操作 不知你有何用,文件一般都是与meno关联使用的
unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,inifiles,StdCtrls, ExtCtrls;typeTForm1 = class(TForm)Edit1: TEdit;CheckBox1: TCheckBox;Edit2: TEdit;Label1: TLabel;Label2: TLabel;Timer1: TTimer;Label3: TLabel;procedure FormCreate(Sender: TObject);procedure FormDestroy(Sender: TObject);procedure Timer1Timer(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementationvarmyinifile:TInifile;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);varfilename:string;beginfilename:=ExtractFilePath(paramstr(0))+'myini.ini';myinifile:=TInifile.Create(filename);edit1.Text:= myinifile.readstring('程序参数','用户名称','缺省的用户名称');edit2.text:= inttostr(myinifile.readinteger('程序参数','已运行时间',0));checkbox1.Checked:= myinifile.readbool('程序参数','是否正式用户',False);end;procedure TForm1.FormDestroy(Sender: TObject);beginmyinifile.writestring('程序参数','用户名称',edit1.Text);myinifile.writeinteger('程序参数','已运行时间',strtoint(edit2.text));myinifile.writebool('程序参数','是否正式用户',checkbox1.Checked);myinifile.Destroy;end;procedure TForm1.Timer1Timer(Sender: TObject);beginedit2.Text:=inttostr(strtoint(edit2.text)+1);end;end.
Memo1:= TMemo.create
Memo1.Parent := Form1;
Memo1.Lines.add('你的文字');
操作文件
Memo1.Lines.SaveToFile('c:\124.txt');