TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: BART BROERSMA
date: 1997-03-23 20:08:00
subject: Trapping Exceptions from TMemo

Hi all,
How do I trap EInOutError exceptions when I use the 
TMemo.Lines.LoadFromFile method ??
I tried this:
try
  FName := OpenRtf.FileName;
  Memo1.Lines.LoadFromFile(FName);
Except
  on E: EInOutError do
  begin
    MessageDlg(E.Message,mtInformation,[mbOk],0);
  end;
end;
Compiles fine, but when I run try to load the memo from a non-existing file 
I get a standard Delphi MessageBox (i.e. Caption=Apllication.Title, 
Text='Cannot open ...',and a STOP-Icon).
Any suggestions here ? I need to be able to know wether the LoadFromFile or 
the SaveToFile has been succesfull.
Greetings,
Bart
--------------------------------------
Bart Broersma
broersma@knmg.nl
 * Wave Rider 1.20 [NR] *
... UNREGISTERED EVALUATION COPY
--- Wave Rider v1.20
---------------
* Origin: Aargh! BBS Amsterdam (2:280/606)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.