delphi4arab منتديات دلفي للعرب

نسخة كاملة : الكتابة أو القرائة من نص
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم ورحمة الله
الكتابة داخل نص أو القرائة منه وطرحه على شكل memo
كود :
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) OpenDialog1: TOpenDialog; Memo1: TMemo; Memo2: TMemo; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Afile:textfile; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var Afile:textfile; S:string; begin AssignFile(Afile,OpenDialog1.FileName) ; Append(Afile) ; s:=memo1.Lines.Text; Writeln(Afile,s); CloseFile(AFile) ; end; procedure TForm1.Button2Click(Sender: TObject); var Afile:textfile; S:string; begin AssignFile(Afile,OpenDialog1.FileName) ; Append(Afile) ; s:=memo2.Lines.Text; Writeln(Afile,s); CloseFile(AFile) ; end; end.