By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,290 Members | 1,263 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,290 IT Pros & Developers. It's quick & easy.

Cannot call Close() while doing CreateHandle

P: n/a
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.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Nice Chap" <Ni******@PlasmaDyne.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
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.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OS**************@TK2MSFTNGP12.phx.gbl...
"Nice Chap" <Ni******@PlasmaDyne.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.