procedure TfrmMain.btnFileClick(Sender: TObject);
begin
if Trim(edtFile.Text) = '' then
dlgOpen.InitialDir := ExtractFilePath(Application.ExeName)
else
dlgOpen.InitialDir := ExtractFilePath(edtFile.Text);
if dlgOpen.Execute then edtFile.Text := dlgOpen.FileName;
end;