Check file existence on Delphi

Function : FIleExists(const FileName:String):Boolean

In the Delphi program, to check the existence of the file, we can use the function FIleExists(const FileName:String):Boolean.

Example:
Create a Form with an Edit (at the time the program starts with the name of the file contents are searched) and 1 Button, do the double click on the Button component, write the following program listing :

procedure TForm1.Button1Click(Sender: TObject);
begin
 if FileExists(Edit1.Text)=True then showmessage('Files that are sought is found')
 else showmessage('Files that are sought are not found');
end;



No comments:

Post a Comment