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. MDI question

MDI question

Scheduled Pinned Locked Moved C#
question
5 Posts 4 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.
  • _ Offline
    _ Offline
    _ReignFire_
    wrote on last edited by
    #1

    Hi, how can i switch between 2 window forms? In my Form1 i have a button and if i press it should open Form2 and close the Form1 i can open the Form2 but if i try to close the first form it wouldn't work :( probably a stupid question but i'd love to know how it works :) i think i have to use some MDI functions...

    W R Z 3 Replies Last reply
    0
    • _ _ReignFire_

      Hi, how can i switch between 2 window forms? In my Form1 i have a button and if i press it should open Form2 and close the Form1 i can open the Form2 but if i try to close the first form it wouldn't work :( probably a stupid question but i'd love to know how it works :) i think i have to use some MDI functions...

      W Offline
      W Offline
      WayKlaro
      wrote on last edited by
      #2

      Show me the fragment of your code and i'll help you...

      _ 1 Reply Last reply
      0
      • W WayKlaro

        Show me the fragment of your code and i'll help you...

        _ Offline
        _ Offline
        _ReignFire_
        wrote on last edited by
        #3

        but i don't really have the code... i know i can make a new form with: Form frmname = new Form(); and show it with frmname.Show(); but thats not the form i want to load... i made a new "Windows Form" with "Add New Item" so you can see a Form2.cs in the solution explorer... and i want to switch from Form1 to Form2 if it's possible. :)

        1 Reply Last reply
        0
        • _ _ReignFire_

          Hi, how can i switch between 2 window forms? In my Form1 i have a button and if i press it should open Form2 and close the Form1 i can open the Form2 but if i try to close the first form it wouldn't work :( probably a stupid question but i'd love to know how it works :) i think i have to use some MDI functions...

          R Offline
          R Offline
          Robert Rohde
          wrote on last edited by
          #4

          Given your really good description (it wouldn't work) I can only guess what is happening. I think that Form1 is your startup form. If you close it the whole application will close. There are several possibilities: 1. Hidden startup form - Make a hidden Form which is your startup Form (that one mentioned in the Main method). - In it's constructor/Load-event open up Form1 - Now you can safely close Form1 without terminating the application 2. Don't switch teh Form - just its contents - If the two Forms have matching size than you could create two user controls instead and add/remove them from the startup form.

          1 Reply Last reply
          0
          • _ _ReignFire_

            Hi, how can i switch between 2 window forms? In my Form1 i have a button and if i press it should open Form2 and close the Form1 i can open the Form2 but if i try to close the first form it wouldn't work :( probably a stupid question but i'd love to know how it works :) i think i have to use some MDI functions...

            Z Offline
            Z Offline
            Zakaria Bin Abdur Rouf
            wrote on last edited by
            #5

            Well, u can hide the form1. set Form1.visible = false --- Eat Bytes Everyday Zakaria Bin Abdur Rouf zakaria7@gmail.com

            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