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. How do I'll to close all the windows?

How do I'll to close all the windows?

Scheduled Pinned Locked Moved C#
question
4 Posts 3 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.
  • A Offline
    A Offline
    alex almeida
    wrote on last edited by
    #1

    well I've this trouble, I need to close all the windows in my app.... I'm using MDIForms. To close some forms I use this code above: foreach(Form frm in this.MdiChildren)//when this is my MDIParent { frm.Close(); } seems simple but I need to close ShowDialog Forms (ShowDialog isn't a MDIChild), when one ShowDialogForm is open I can't to close it, It's still open, How do I'll to close it? Thanks

    A 1 Reply Last reply
    0
    • A alex almeida

      well I've this trouble, I need to close all the windows in my app.... I'm using MDIForms. To close some forms I use this code above: foreach(Form frm in this.MdiChildren)//when this is my MDIParent { frm.Close(); } seems simple but I need to close ShowDialog Forms (ShowDialog isn't a MDIChild), when one ShowDialogForm is open I can't to close it, It's still open, How do I'll to close it? Thanks

      A Offline
      A Offline
      allan gagnon
      wrote on last edited by
      #2

      Alex I am still a newbie at C# also but I am developing a MDIApplication and I am using a Login form as a dialog. To close that form I have put a close button on the form and then used the code this.dispose(); as the way to close it. private void button1_Click(object sender, EventArgs e) { this.dispose(); } Hope this helps! Allan Allan F. Gagnon

      S A 2 Replies Last reply
      0
      • A allan gagnon

        Alex I am still a newbie at C# also but I am developing a MDIApplication and I am using a Login form as a dialog. To close that form I have put a close button on the form and then used the code this.dispose(); as the way to close it. private void button1_Click(object sender, EventArgs e) { this.dispose(); } Hope this helps! Allan Allan F. Gagnon

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        You should use the Close method instead of Dispose to close your login form.


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        1 Reply Last reply
        0
        • A allan gagnon

          Alex I am still a newbie at C# also but I am developing a MDIApplication and I am using a Login form as a dialog. To close that form I have put a close button on the form and then used the code this.dispose(); as the way to close it. private void button1_Click(object sender, EventArgs e) { this.dispose(); } Hope this helps! Allan Allan F. Gagnon

          A Offline
          A Offline
          alex almeida
          wrote on last edited by
          #4

          Thanks Allan But I can to close one window.... The problem is many windows.. I'm going to explain my app, when time expire I need to close all windows that are open, however, some of these windows are ShowDialog, when I execute the sample code above the only windows that are closed are the MDIChildren, however, ShowDialog windows not is MDIChild and therefore still open, I can't handle these. I don't know who is owner of theses windows ShowDialog() I'm tired..:laugh:

          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