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. Closing an MDI Child Form

Closing an MDI Child Form

Scheduled Pinned Locked Moved C#
questionhelptutorial
3 Posts 2 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.
  • G Offline
    G Offline
    gonad
    wrote on last edited by
    #1

    How can i tell what forms are currently open and how do i close a specific form? My main form is an MDI parent with a toolbar. One button opens a form and when i click another button, i want to close the one that's open, but i'm having a hard time finding out what is open and how to close it. Thanks for your help. .gonad.

    G 1 Reply Last reply
    0
    • G gonad

      How can i tell what forms are currently open and how do i close a specific form? My main form is an MDI parent with a toolbar. One button opens a form and when i click another button, i want to close the one that's open, but i'm having a hard time finding out what is open and how to close it. Thanks for your help. .gonad.

      G Offline
      G Offline
      gonad
      wrote on last edited by
      #2

      [ append from previous post ] the only way i know how to do this is: this.MDIChildren[0].Close(); this works for me since i only want one form open at a time, but i just want to know if there's another way to do this. Thanks! .gonad.

      S 1 Reply Last reply
      0
      • G gonad

        [ append from previous post ] the only way i know how to do this is: this.MDIChildren[0].Close(); this works for me since i only want one form open at a time, but i just want to know if there's another way to do this. Thanks! .gonad.

        S Offline
        S Offline
        sumeat
        wrote on last edited by
        #3

        Form has a ActiveMDIChild property, this is the currently active child form. You can use this property to close the topmost (active) child form. Suhas

        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