Hi, thanks for your answer. Here's the next question
, hope you can
help
me too.
So now, I have successfullly hooked up to the parent Form's event. In the
event handler, my component would perform some checking on the machine. If
the check fails, I want to close the Form and exit the main application.
If I
call Application.Exit(), nothing happens. If I call parent.Close(), the
form
does close, but all the event handlers registered to the form's
Closed/Closing events get fired before that, which I don't want. Not to
mention that the Closing event handlers can stop the form from closing by
setting Cancel property of the CancelEventArgs object to 'false'. How to
workaround this issue ? What I want is close the form immediately without
any
other subsequent actions performed.
Thanks in advance.
Stoitcho Goutsev (100) said:
Dotnetjunky,
AFAIK you can't unless you create your own custom designer and serialize
code that sets the form reference to a property of your component. See
how
MainMenu, for example, gets the reference to the form.
--
HTH
Stoitcho Goutsev (100) [C# MVP]
Dotnetjunky said:
Hi experts,
I created a custom Component in VS.NET 2003. From my component, I need
to
catch the Load event of the parent Form. The question is how can I get
the
reference to the parent instance, without passing it to the constructor
of
my
component (because VS.NET designer use default constructor at
design-time.)
Thanks in advance.
Dotnetjunky