Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Close All Child Window on Menu Click!

Close All Child Window on Menu Click!

Scheduled Pinned Locked Moved C#
csharp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sr Frank
    wrote on last edited by
    #1

    I am working on a MDIForm in C#. Here we can open many child form inside MDI, now I am trying to write a code which can close all child form on menu click. Please let me know right code. Thanks

    N H 2 Replies Last reply
    0
    • S Sr Frank

      I am working on a MDIForm in C#. Here we can open many child form inside MDI, now I am trying to write a code which can close all child form on menu click. Please let me know right code. Thanks

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Sr...Frank wrote:

      Please let me know right code.

      By this you mean, write code for me. No. You have a list of the child windows, iterate through them and close. If you have tried and need help, then post what you have tried and ask.


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • S Sr Frank

        I am working on a MDIForm in C#. Here we can open many child form inside MDI, now I am trying to write a code which can close all child form on menu click. Please let me know right code. Thanks

        H Offline
        H Offline
        Heinzzy
        wrote on last edited by
        #3

        private void button2_Click(object sender, EventArgs e)
        {
        foreach (Form2 f in this.MdiChildren)
        {
        f.Dispose();
        }
        }

        S N 2 Replies Last reply
        0
        • H Heinzzy

          private void button2_Click(object sender, EventArgs e)
          {
          foreach (Form2 f in this.MdiChildren)
          {
          f.Dispose();
          }
          }

          S Offline
          S Offline
          Sr Frank
          wrote on last edited by
          #4

          Thanks Hen

          L 1 Reply Last reply
          0
          • S Sr Frank

            Thanks Hen

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            please don't remove messages, it is against the forum guidelines. :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            If you want my opinion or comment, ask in a forum or on my profile page; I will not participate in frackin' Q&A


            1 Reply Last reply
            0
            • H Heinzzy

              private void button2_Click(object sender, EventArgs e)
              {
              foreach (Form2 f in this.MdiChildren)
              {
              f.Dispose();
              }
              }

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Please don't feed the idiots.


              I know the language. I've read a book. - _Madmatt

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups