"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> schrieb
I have a [base] Form from which lots of others will be
derived. One of the base Form properties is a communication
"channel" to an external application. If this external
application isn't running, I want to /prevent/ the creation of
the derived Form (essentially kill the [derived] application
stone dead).
. . .
Don't catch the exception in the constructor, so you'll get it
where you create the instance:
Ah! I don't (yet). The inherited form is the "main" (and usually
only) form in the application, and VB is currently starting it for
me - presumably, I'm going to have to change this and insist that
my Developers use Sub Main to get all their programs up and
running?
If you want to check something /before/ creating the main Form, yes, you'd
have to write a sub main. That's what I would do, but others will perhaps
make other suggestions. I don't like interrupting creating/showing a Form,
and I also prefer to use a Form only as the user interface and do jobs like
'ConnectToExternalApp' outside the Form, at least if both reasons come
together.
--
Armin