Close all child forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • K.K.

    #1

    Close all child forms

    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?ke yword="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.


  • Cor Ligthert

    #2
    Re: Close all child forms

    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/de...classtopic.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


    Comment

    • Kay

      #3
      Re: Close all child forms

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

      K.K.


      "Cor Ligthert" <notmyfirstname @planet.nl> wrote in message
      news:%239uVUXeW FHA.2984@tk2msf tngp13.phx.gbl. ..[color=blue]
      > 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/de...classtopic.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
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Close all child forms

        "K.K." <kk@micxsoft.co m> schrieb:[color=blue]
        > 'UPGRADE_ISSUE: Forms collection was not upgraded. Click for more:
        > 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?ke yword="vbup2068 "'
        >
        > For Each Frm
        > Frm.Close()
        > Next Frm[/color]

        The 'Forms' collection as known from VB6 has gone:

        Reclaim the Lost VB6 Forms Collection
        <URL:http://www.fawcette.co m/vsm/2002_12/online/hottips/lobel/>

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

        Comment

        Working...