Advertisement
miguelhosttimer

escreve dentro do arquivo selicionado

May 15th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.83 KB | None | 0 0
  1.       unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, ShlObj;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     OpenDialog1: TOpenDialog;
  13.     Edit1: TEdit;
  14.     procedure Button1Click(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.  
  24. implementation
  25.  
  26. {$R *.dfm}
  27.  
  28. procedure TForm1.Button1Click(Sender: TObject);
  29. var
  30.   ArquivoTexto: TStringList;
  31. begin
  32.   if OpenDialog1.Execute then
  33.   begin
  34.     ArquivoTexto := TStringList.Create;
  35.     try
  36.       ArquivoTexto.Add(Edit1.Text);
  37.       ArquivoTexto.SaveToFile(OpenDialog1.FileName);
  38.     finally
  39.       ArquivoTexto.Free;
  40.     end;
  41.   end;
  42. end;
  43.  
  44. end.
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement