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. switching between forms

switching between forms

Scheduled Pinned Locked Moved C#
csharpquestion
6 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.
  • P Offline
    P Offline
    PaulaM
    wrote on last edited by
    #1

    hi, iam currently working on a winform application using Visual C#,i would like my application to be able to switch between two open forms and work on one without minimizing the other. eg explore My Computer, while the window is still open explore Desktop (another window opens ) note you can switch between the two windows without minimizing one is u can refer me to any articles or code examples that work that way please refer me i hope you understand my question thanks :-D regards paula

    M A J 3 Replies Last reply
    0
    • P PaulaM

      hi, iam currently working on a winform application using Visual C#,i would like my application to be able to switch between two open forms and work on one without minimizing the other. eg explore My Computer, while the window is still open explore Desktop (another window opens ) note you can switch between the two windows without minimizing one is u can refer me to any articles or code examples that work that way please refer me i hope you understand my question thanks :-D regards paula

      M Offline
      M Offline
      MCSD Gandalf
      wrote on last edited by
      #2

      I may be missing something but... Add a second form to your application, assume it is Form2. In some event on Form1 (button click whatever), put the following code Form2 frm2 = new Form2(); frm2.Show(); Both forms should be open and available. All you have to do is make sure that neither of them is maximized. You can even limit the size with the MaximumSize property so neither of them takes the whole area. HTH Gandalf

      P 1 Reply Last reply
      0
      • P PaulaM

        hi, iam currently working on a winform application using Visual C#,i would like my application to be able to switch between two open forms and work on one without minimizing the other. eg explore My Computer, while the window is still open explore Desktop (another window opens ) note you can switch between the two windows without minimizing one is u can refer me to any articles or code examples that work that way please refer me i hope you understand my question thanks :-D regards paula

        A Offline
        A Offline
        Andrei Ungureanu
        wrote on last edited by
        #3

        If you have created 2 forms in the same project all tou have to do is to open them with the Show method. Form1 f = new Form1(); f.Show(); Make sure that both of the forms are visible in the System Taskbar(ShowInTaskbar Property). If you want ony one form at a time use the ShowDialog() method

        P 1 Reply Last reply
        0
        • P PaulaM

          hi, iam currently working on a winform application using Visual C#,i would like my application to be able to switch between two open forms and work on one without minimizing the other. eg explore My Computer, while the window is still open explore Desktop (another window opens ) note you can switch between the two windows without minimizing one is u can refer me to any articles or code examples that work that way please refer me i hope you understand my question thanks :-D regards paula

          J Offline
          J Offline
          Jun Du
          wrote on last edited by
          #4

          First, I'm trying to clarify your requirements. Correct me if that is not what you want. You want your application to have some virtual desktop feature so that when you switch to next window, you don't see any other windows, but you cannot minimize, hide or disable those unseen windows. My solution is using virtual screen. Lets say your monitor has a resolution of 1280x1024. Your virtual screen will be 2560x1024.

          -----------------------------------
          | | |
          | | |
          | Monitor | Unused |
          | | |
          | | |
          | | |

          First, position all your windows in the UNUSED area. You can do so by changing the size/location property. Then, whatever window you want to switch to, just reposition that window to the MONITOR area. The key point is that whenever you open a window or draw anything in the UNUSED area, you will not see it, but your rendering logic remains functioning. You may implement this directly to the screen, or in the memory (double buffering). Hope this helps. - It's easier to make than to correct a mistake.

          1 Reply Last reply
          0
          • A Andrei Ungureanu

            If you have created 2 forms in the same project all tou have to do is to open them with the Show method. Form1 f = new Form1(); f.Show(); Make sure that both of the forms are visible in the System Taskbar(ShowInTaskbar Property). If you want ony one form at a time use the ShowDialog() method

            P Offline
            P Offline
            PaulaM
            wrote on last edited by
            #5

            thanks for replying actualy that is not what im looking for lets say i have two forms ,form2 and form2 and a in my form2 i have button and in the button click event i have the code Form2 f = new Form2(); f.Show(); my form2 shows i want to switch between these two forms currently i can only work with form2 bcause its active i want both of them to be active so if i want to change something in form1 i should be able to. thanks:) regards paula

            1 Reply Last reply
            0
            • M MCSD Gandalf

              I may be missing something but... Add a second form to your application, assume it is Form2. In some event on Form1 (button click whatever), put the following code Form2 frm2 = new Form2(); frm2.Show(); Both forms should be open and available. All you have to do is make sure that neither of them is maximized. You can even limit the size with the MaximumSize property so neither of them takes the whole area. HTH Gandalf

              P Offline
              P Offline
              PaulaM
              wrote on last edited by
              #6

              thanks for replying actualy that is not what im looking for lets say i have two forms ,form2 and form2 and a in my form2 i have button and in the button click event i have the code Form2 f = new Form2(); f.Show(); my form2 shows i want to switch between these two forms currently i can only work with form2 bcause its active i want both of them to be active so if i want to change something in form1 i should be able to. regards paula

              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