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. Visual Basic
  4. How to close all open MDI children without closing the Parent

How to close all open MDI children without closing the Parent

Scheduled Pinned Locked Moved Visual Basic
databasetutorial
2 Posts 1 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.
  • N Offline
    N Offline
    newbjohny
    wrote on last edited by
    #1

    Hi, I am creating a GUI to a database, I would like to know when I click a button to open a new database, all open MDI children relating to the old database that are open are closed without closing the parent form. I stored the name of the parent form into a module and tried this, but it only closes one, if there are more than one it does not work. ParentName.mdif.ActiveMdiChild.Close() Any suggestions are greatfully appreciated. John

    N 1 Reply Last reply
    0
    • N newbjohny

      Hi, I am creating a GUI to a database, I would like to know when I click a button to open a new database, all open MDI children relating to the old database that are open are closed without closing the parent form. I stored the name of the parent form into a module and tried this, but it only closes one, if there are more than one it does not work. ParentName.mdif.ActiveMdiChild.Close() Any suggestions are greatfully appreciated. John

      N Offline
      N Offline
      newbjohny
      wrote on last edited by
      #2

      I managed to get it done, I pasted the code underneath incase someone else has a similar problem. John Dim form As System.Windows.Forms.Form For Each form In Me.MdiChildren form.Close() Next form

      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