Page 1 of 1

Connect on FormCreate

Posted: Mon 24 Nov 2008 22:53
by mariusz
I have MainForm (Form1) with IBCCOnnection and IBCCOnnectDialog.
In TForm1.FormCreate I have code


IBCConnection1.Connect;
if IBCConnection1.connected true
then Application.Terminate;

Showmessage('Some message');


I'm starting application and canceling connectDialog form. I'm expecting 'application termination' or 'Some message', but I have nothing.
After canceling connectdialog form, program bypassing rest of FormCreate procedure.

Why? How to perform this?

regards
M.

Posted: Tue 25 Nov 2008 08:43
by Plash
When you press the Cancel button, exception of type EAbort is raised. So that the FormCreate method is interrupted. Call the Connect method in try..except block to catch this exception.