Connect on FormCreate

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mariusz
Posts: 62
Joined: Wed 16 Jul 2008 21:04
Location: Poland / Poznan
Contact:

Connect on FormCreate

Post by mariusz » Mon 24 Nov 2008 22:53

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.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 25 Nov 2008 08:43

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.

Post Reply