Home > Back-end >  D7 tmemo read specify document content with the modified content
D7 tmemo read specify document content with the modified content

Time:09-25

D7 tmemo read specify document content with modified save great god teach content

CodePudding user response:

 unit Unit1; 

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1=class (TForm)
For: TButton;
Button2: TButton;
Memo1: TMemo;
OpenDialog1: TOpenDialog;
Procedure Button1Click (Sender: TObject);
Procedure Button2Click (Sender: TObject);
Private
{Private declarations}
TextName: string;//global variables to save the file
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
The begin
OpenDialog1. FileName:=' ';
Opendialog1. InitialDir:=sPath;
Opendialog1. Filter:='| text file *. TXT';
If OpenDialog1. Execute then
The begin
TextName:=OpenDialog1. FileName;
Memo1. Lines. LoadFromFile (TexxtName);//open the file
The end;
end;


Procedure TForm1. Button2Click (Sender: TObject);
The begin
Memo1. Lines. SaveToFile (TexxtName);//save the file
end;

End.
for the open text files,
Button2, through the Memo after modify text files, formerly known as save the file,
  • Related