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. Open only one child form

Open only one child form

Scheduled Pinned Locked Moved C#
helpquestion
3 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.
  • B Offline
    B Offline
    Boipelo
    wrote on last edited by
    #1

    I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006

    A P 2 Replies Last reply
    0
    • B Boipelo

      I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006

      A Offline
      A Offline
      akyriako78
      wrote on last edited by
      #2

      Make the base class of your child form to implement the singleton pattern

      1 Reply Last reply
      0
      • B Boipelo

        I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open. I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ? Interfaces - Is the folder Name where all forms are located frmPerson - is the child form (requered form to open) private void mnuManagePerson_Click(object sender, System.EventArgs e) { if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null) { Form frmchildfrmPerson=new Interfaces.frmPerson(); frmchildfrmPerson.MdiParent = this; frmchildfrmPerson.Show(); } } Cool Joe "Only the best" South Africa -- modified at 5:12 Friday 17th March, 2006

        P Offline
        P Offline
        pawan kumarsoft
        wrote on last edited by
        #3

        hi all i have a sample code this will solve your problem take a form and ToolStripMenuItem from vs toolbox duble click on opentoolstrip and write these code private void openToolStripMenuItem_Click(object sender, EventArgs e) { openToolStripMenuItem.Enabled = false; Form2 frm = new Form2(); frm.MdiParent = this; frm.FormClosed += new FormClosedEventHandler(frm_FormClosed); frm.Show(); } void frm_FormClosed(object sender, FormClosedEventArgs e) { openToolStripMenuItem.Enabled = true; }

        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