Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Exception bei OpenDialog (https://www.delphipraxis.net/119736-exception-bei-opendialog.html)

Thomm 30. Aug 2008 22:09


Exception bei OpenDialog
 
Beim OpenDialog1 tritt bei mir immer Exception auf,
wenn man auf "Abbrechen" klickt

Delphi-Quellcode:
procedure TForm1.Oeffnen1Click(Sender: TObject);
begin
OpenDialog1.Execute;
try
clientdataset1.LoadFromFile(OpenDialog1.FileName);
except
Application.MessageBox('Datei kann nicht geöffnet werden','Fehler',16);
exit;
end;
end;
Weiß jemand wie das mit dem Button "Abbrechen" funktioniert ?

Neutral General 30. Aug 2008 22:10

Re: Exception bei OpenDialog
 
Hi,

Delphi-Quellcode:
if Opendialog1.Execute then
  // Es wurde OK gedrückt
Gruß
Neutral General

omata 30. Aug 2008 22:11

Re: Exception bei OpenDialog
 
Delphi-Quellcode:
procedure TForm1.Oeffnen1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then begin
    try
      clientdataset1.LoadFromFile(OpenDialog1.FileName);
    except
      Application.MessageBox('Datei kann nicht geöffnet werden', 'Fehler', 16);
    end;
  end;
end;

Thomm 30. Aug 2008 22:13

Re: Exception bei OpenDialog
 
Danke, für die Hilfe :-D


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:26 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz