Mengecek Status Keberadaan File (Found/Not Found)

Untuk mengecek status keberadaan file, bisa gunakan fungsi File Search.  Perintah dasar untuk File Search dalam delphi adalah  FileSearch(const Name, DirList: string): string;

Berikut contoh penerapan File Search. Siapkan sebuah EditText dan Button, dan terapkan source code berikut ini.

procedure TForm1.Button1Click(Sender: TObject);
var
FileToFind: string;
begin
FileToFind := FileSearch(Edit1.Text, GetCurrentDir);
if FileToFind = '' then
ShowMessage('Couldn''t find ' + Edit1.Text + '.')
else
ShowMessage('Found ' + FileToFind + '.');
end;

No feedback yet

    Share Your Thoughts


    Your email address will not be revealed on this site.

    Your URL will be displayed.
    :!: :?: :idea: :) :D :p B) ;) :> :roll: :oops: :| :-/ :( :'( |-| :>> :yes: ;D :P :)) 88| :. :no: XX( :lalala: :crazy: >:XX
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)