Cannot call Close() while doing CreateHandle

  • Thread starter Thread starter Nice Chap
  • Start date Start date
N

Nice Chap

I get this exception when I call Me.Close on Load event of a Form. The form
producing the error is an MDI child of another form. Any ideas how I can get
over this problem please.

I have tried doing Me.Close on HandleCreated and Activated events but get
the same exception.
 
Nice Chap said:
I get this exception when I call Me.Close on Load event of a Form. The form
producing the error is an MDI child of another form. Any ideas how I can
get over this problem please.

I have tried doing Me.Close on HandleCreated and Activated events but get
the same exception.


Simply don't call the form's 'Show' or 'ShowDialog' method or don't set its
'Visible' property to 'True' instead of closing it in order to prevent it
from being shown.
 
I am replying to my own question for the benefit of others.

In case you wanted to close an MDI Child on load, then the answer is... do
it on VisibleChanged event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top