It quite depends on what error you're expecting or wanting to trap and from where you're expecting it to come.
Nevertheless, maybe a better way to do what your code is trying would be something like:
var
AFilename: String;
begin
AFilename := 'C:\WGKBlck\Images\' + SQLQuery.FieldByName('PicName').AsString;
if FileExists(aFilename) then begin
DetHilfe.Image1.Picture.LoadFromFile(AFilename);
DetHilfe.Label1.Caption:= SQLQuery.FieldByName(FeldD).AsString;
//On Error go To 0 ... what error do you expect?
DetHilfe.ShowModal;
DetHilfe.Image1.Picture := DetHilfe.Image2.Picture;
KvonZub := true;
end;
end;
Now, for example, if you're trying to guard against the image file being corrupt or not being a handled format, etc. that would be something like:
var
AFilename: String;
begin
AFilename := 'C:\WGKBlck\Images\' + SQLQuery.FieldByName('PicName').AsString;
if FileExists(aFilename) then
try
DetHilfe.Image1.Picture.LoadFromFile(AFilename);
DetHilfe.Label1.Caption:= SQLQuery.FieldByName(FeldD).AsString;
//On Error go To 0 ... what error do you expect?
DetHilfe.ShowModal;
DetHilfe.Image1.Picture := DetHilfe.Image2.Picture;
KvonZub := true;
except
on e: EGraphicException do
ShowMessage('Failed to load image:'
+ LineEnding
+ e.Message);
end;
end;
If you still have doubts you should first read "
chapter 17 - Exceptions" of the Reference Guide to get an overview of how errors (exceptions) are handled.
HTH!