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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How we can stop to creating new Instance on same click of form

How we can stop to creating new Instance on same click of form

Scheduled Pinned Locked Moved C#
help
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.
  • T Offline
    T Offline
    Trivikram Dwivedi
    wrote on last edited by
    #1

    hi friends,please help me. i have written code for into mdi form for openning a child form. private void menuItem7_Click(object sender, System.EventArgs e) { frmBaseForm frmLoad= new frmBaseForm(); frmLoad.MdiParent =this; frmLoad.Left =0; frmLoad.Top =0; frmLoad.Show(); } when i click menu more then once,this code open more then one form. i don't want that. it can be solve by using variable and may be enabling disabling the menu item. but i want optimum solution thnx a lot

    I 1 Reply Last reply
    0
    • T Trivikram Dwivedi

      hi friends,please help me. i have written code for into mdi form for openning a child form. private void menuItem7_Click(object sender, System.EventArgs e) { frmBaseForm frmLoad= new frmBaseForm(); frmLoad.MdiParent =this; frmLoad.Left =0; frmLoad.Top =0; frmLoad.Show(); } when i click menu more then once,this code open more then one form. i don't want that. it can be solve by using variable and may be enabling disabling the menu item. but i want optimum solution thnx a lot

      I Offline
      I Offline
      Itanium
      wrote on last edited by
      #2

      Use this function...if it suits you... frmBaseForm frmLoad= new frmBaseForm(); ShowMdiChild(frmLaod); private void ShowMdiChild(Form frm) { if(frm==null) return; for(int i = 0 ; i < this.MdiChildren.GetLength(0) ; i++ ) if(this.MdiChildren[i].Name.Equals(frm.Name)) return; //if (! this.Contains(frm)) frm.MdiParent = this; frm.Show(); } sorry for my bad English.

      T 1 Reply Last reply
      0
      • I Itanium

        Use this function...if it suits you... frmBaseForm frmLoad= new frmBaseForm(); ShowMdiChild(frmLaod); private void ShowMdiChild(Form frm) { if(frm==null) return; for(int i = 0 ; i < this.MdiChildren.GetLength(0) ; i++ ) if(this.MdiChildren[i].Name.Equals(frm.Name)) return; //if (! this.Contains(frm)) frm.MdiParent = this; frm.Show(); } sorry for my bad English.

        T Offline
        T Offline
        Trivikram Dwivedi
        wrote on last edited by
        #3

        thnx a lot,its working fine

        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