TOpenDialogTitle (Delphi)
Description
Click the button to open a TOpenDialog, then select a file to delete.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
F: Textfile;
begin
OpenDialog1.Title := 'Delete File';
if OpenDialog1.Execute then
begin
AssignFile(F, OpenDialog1.FileName);
try
Reset(F);
if MessageDlg('Erase ' + OpenDialog1.FileName + '?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
CloseFile(F);
Erase(F);
end;
except
on EInOutError do
MessageDlg('File I/O error.', mtError, [mbOk], 0);
end;
end;
end;
Uses
- Vcl.Dialogs.TOpenDialog.Title ( fr | de | ja )
- Vcl.Dialogs.TOpenDialog.FileName ( fr | de | ja )
- System.CloseFile ( fr | de | ja )
- System.Erase ( fr | de | ja )
- System.Reset ( fr | de | ja )
- System.AssignFile ( fr | de | ja )
- System.SysUtils.EInOutError ( fr | de | ja )