Close all child forms

  • Thread starter Thread starter K.K.
  • Start date Start date
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.
 
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
 
Back
Top