check whether a file exists in a particular directory
To check whether a file exists in a particular directory, you can use the provided functions in Delphi.
Formula functions:
FileExists (const FileName: string): boolean.
The first step: Lay and Edit Button in the Form
Step two: fill the program with the program listing below
Procedure Tfrom.Button1Click(Sender:TObject);
begin
if Edit1.Text = ' ' then
ShowMessage('isikankan nama file yang dicari')
else
begin
if FileExits(Edit1.Text) = true then // jika ada
ShowMessage('file " ' +Edit1.Text + ' " ada. ')
else // Jika tidak ada
showMessage('File " ' +Edit1.Text + ' " tidak dtemukan. ');
end;
end;
step 3 : Klik Run