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. Locking a form when another form is opened???

Locking a form when another form is opened???

Scheduled Pinned Locked Moved C#
csharptutorialquestion
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.
  • S Offline
    S Offline
    shw 234
    wrote on last edited by
    #1

    Hi, I need the following functionality in my application. I have a main form, from where I display second form to get input to the main form. I want to lock the main form until I get the input from the second form. Can somebody advise me how to acheive this from c#.net windows based application? Thanks Sunitha

    A J 2 Replies Last reply
    0
    • S shw 234

      Hi, I need the following functionality in my application. I have a main form, from where I display second form to get input to the main form. I want to lock the main form until I get the input from the second form. Can somebody advise me how to acheive this from c#.net windows based application? Thanks Sunitha

      A Offline
      A Offline
      ahmed eldeghedy
      wrote on last edited by
      #2

      try this if it help yourformyouwanttoshow.ShowDialog();

      ahmed eldeghedy

      1 Reply Last reply
      0
      • S shw 234

        Hi, I need the following functionality in my application. I have a main form, from where I display second form to get input to the main form. I want to lock the main form until I get the input from the second form. Can somebody advise me how to acheive this from c#.net windows based application? Thanks Sunitha

        J Offline
        J Offline
        jas0n23
        wrote on last edited by
        #3

        Hello, Have you tried using the

        ShowDialog()

        method when you are opening the second window from within the form1's code? E.g.:

            private void button1\_Clicked(object sender, EventArgs e)
            {
                 Form SecondForm = new SecondForm();
                 SecondForm.ShowDialog();
            }
        

        This will open the second form on-top of the first form, and the main form cannot be accessed until the second form has been disposed. Hope this helps.

        j.t.

        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