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. Manage MDI childs

Manage MDI childs

Scheduled Pinned Locked Moved Visual Basic
question
8 Posts 6 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.
  • H Offline
    H Offline
    highjo
    wrote on last edited by
    #1

    hello! i've created a small mdi sofware and.to open a child form a user should click on the menu item corresponding.Even if the same form is already openned when i click on the same menu item it opens again the ssame form which is not logical.How can i prevent the form to be openned more than once.thanks

    eager to learn

    J D A 3 Replies Last reply
    0
    • H highjo

      hello! i've created a small mdi sofware and.to open a child form a user should click on the menu item corresponding.Even if the same form is already openned when i click on the same menu item it opens again the ssame form which is not logical.How can i prevent the form to be openned more than once.thanks

      eager to learn

      J Offline
      J Offline
      J 0
      wrote on last edited by
      #2

      I haven't work in VB for a while, so I apologize if my syntax is off. What you should do is something along the lines of: Dim myForm as New Form1() myForm.Show()

      Y 1 Reply Last reply
      0
      • J J 0

        I haven't work in VB for a while, so I apologize if my syntax is off. What you should do is something along the lines of: Dim myForm as New Form1() myForm.Show()

        Y Offline
        Y Offline
        yogesh_kumar_agarwal
        wrote on last edited by
        #3

        Hi J$ Your code do the same thing, and the problem remains same do this .show did not create the new object for the form else ti will display the form again and again With Regards Yogesh Agarwal

        1 Reply Last reply
        0
        • H highjo

          hello! i've created a small mdi sofware and.to open a child form a user should click on the menu item corresponding.Even if the same form is already openned when i click on the same menu item it opens again the ssame form which is not logical.How can i prevent the form to be openned more than once.thanks

          eager to learn

          D Offline
          D Offline
          darkelv
          wrote on last edited by
          #4

          I have a similar reply here.[^]

          S 1 Reply Last reply
          0
          • D darkelv

            I have a similar reply here.[^]

            S Offline
            S Offline
            Sachin Gokhale
            wrote on last edited by
            #5

            Create a object of the form (probably in a module)- For e.g Dim objfrm1 as Form1 Now, on click event of the context menu (or button) write the following code - if isnothing(objfrm1) then objfrm1 = new form1 objfrm1.MdiParent = me objfrm1.show() else objfrm1.focus() end if Also, do not forget to set the obj to nothing on the form closing event. I mean, on CLOSING event of form1 write the followng code. objfrm1 = nothing Worring about losing keeps me WINNING>>..

            H 1 Reply Last reply
            0
            • H highjo

              hello! i've created a small mdi sofware and.to open a child form a user should click on the menu item corresponding.Even if the same form is already openned when i click on the same menu item it opens again the ssame form which is not logical.How can i prevent the form to be openned more than once.thanks

              eager to learn

              A Offline
              A Offline
              Anoop Brijmohun
              wrote on last edited by
              #6

              Hi try this dim frm as form1 frm.showdialogue(me) this wont let the user work with anything other form, until this form closes! hope this helps...

              H 1 Reply Last reply
              0
              • A Anoop Brijmohun

                Hi try this dim frm as form1 frm.showdialogue(me) this wont let the user work with anything other form, until this form closes! hope this helps...

                H Offline
                H Offline
                highjo
                wrote on last edited by
                #7

                ok thanks will try different suggestion here and tell which is cool.Thanks again guys!

                eager to learn

                1 Reply Last reply
                0
                • S Sachin Gokhale

                  Create a object of the form (probably in a module)- For e.g Dim objfrm1 as Form1 Now, on click event of the context menu (or button) write the following code - if isnothing(objfrm1) then objfrm1 = new form1 objfrm1.MdiParent = me objfrm1.show() else objfrm1.focus() end if Also, do not forget to set the obj to nothing on the form closing event. I mean, on CLOSING event of form1 write the followng code. objfrm1 = nothing Worring about losing keeps me WINNING>>..

                  H Offline
                  H Offline
                  highjo
                  wrote on last edited by
                  #8

                  hi i've tried the suggestoin of Sachin Gokhale and he's right.I found it so easy and i was wondering why i couldn't find it myself.Thanks man :-D

                  eager to learn

                  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