Close all child forms

K

K.K.

Hi all,

I just have a small vb6 upgraded to dot net and now I'm fixing the problem
according to the upgrade report. Most of them are easily fixed except one
I'm not quite sure ...

I have a MDI form, in vb6 when I close it I have the following code :

Dim Frm As Form

For Each Frm In Forms
Unload Frm
Next

Now it has problem :
'UPGRADE_ISSUE: Forms collection was not upgraded. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2068"'

For Each Frm
Frm.Close()
Next Frm

Can someone guide me how to fix it? I don't have .net experience so your
help is very appreciated~ Thanks~

K.K.
 
C

Cor Ligthert

KK,

Probably you don't have to unload them, so try first what happens when you
delete that phrase.

If you really need to close them, by instance to start new in the middle of
your program, than you can in your MDI container Form use the collection
mdiChildren.

http://msdn.microsoft.com/library/d...frlrfsystemcollectionsarraylistclasstopic.asp

However be aware that this is than not as easy as it looks, because a "form"
has to be IsDisposed (don't mix this up with calling dispose) when you
create them new again.

I hope this helps,

Cor
 
K

Kay

Thanks Cor, I'll just remove the code and see how it works, thanks for ur
link too~

K.K.
 

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

Similar Threads


Top