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. Mouse Click

Mouse Click

Scheduled Pinned Locked Moved C#
tutorialquestion
5 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.
  • A Offline
    A Offline
    Antonius_r3
    wrote on last edited by
    #1

    I have a MDI application frm_parents is the MDI parents with a main menu and shortcut. When it load, it load MDI Child frm_login. It's basicaly a login frame that I've created. I would like to create a code where when frm_login is still active, no other command (mouse or shortcut) can be used. I made a active flag (frm_login_activated). It's equal to true when frm_login is loaded, and false when frm_login is closed. Does anyone know how to do it? Thank you very much in advance.

    D 1 Reply Last reply
    0
    • A Antonius_r3

      I have a MDI application frm_parents is the MDI parents with a main menu and shortcut. When it load, it load MDI Child frm_login. It's basicaly a login frame that I've created. I would like to create a code where when frm_login is still active, no other command (mouse or shortcut) can be used. I made a active flag (frm_login_activated). It's equal to true when frm_login is loaded, and false when frm_login is closed. Does anyone know how to do it? Thank you very much in advance.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Why would you make the login form a child form? Why not make it a normal dialog form and show it, from your main form, with .ShowDialog(). This way, the form is displayed as a modal dialog, you can't use the underlying main form until this dialog is OK'd or Cancel'd, and you can get the return value from the form so your main code knows weather or not the user logged in and can take appropriate action. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Why would you make the login form a child form? Why not make it a normal dialog form and show it, from your main form, with .ShowDialog(). This way, the form is displayed as a modal dialog, you can't use the underlying main form until this dialog is OK'd or Cancel'd, and you can get the return value from the form so your main code knows weather or not the user logged in and can take appropriate action. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        A Offline
        A Offline
        Antonius_r3
        wrote on last edited by
        #3

        Yes, you are right. I didn't think about that one :) It worked perfectly. Thanks a lot :)

        E 1 Reply Last reply
        0
        • A Antonius_r3

          Yes, you are right. I didn't think about that one :) It worked perfectly. Thanks a lot :)

          E Offline
          E Offline
          ezak
          wrote on last edited by
          #4

          1-hi... 2-make an instance of chlid form in the parent form fchild f2=new fchild(); set the flag that u made it in the child form as public and write this code in parent form private bool f1flag; the menuitem1_click(.......,........) { f1flag=f2.f2flag; if(f1flag==true) { f2=new Form2(); f2.MdiParent=this; f2.Show(); } else{f2.activate();} } ....and in child form on the event close set the f2flag=true and on the f2_load set f2flag=false hi i am ezak neno

          D 1 Reply Last reply
          0
          • E ezak

            1-hi... 2-make an instance of chlid form in the parent form fchild f2=new fchild(); set the flag that u made it in the child form as public and write this code in parent form private bool f1flag; the menuitem1_click(.......,........) { f1flag=f2.f2flag; if(f1flag==true) { f2=new Form2(); f2.MdiParent=this; f2.Show(); } else{f2.activate();} } ....and in child form on the event close set the f2flag=true and on the f2_load set f2flag=false hi i am ezak neno

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            That's a lot of garbage to go through when all you need for a Login Form is wheather or not the user was successfully logged in or not. I like this in the main form better:

            frmLoginForm myLoginForm = new frmLoginForm;
            DialogResult loginResult = myLoginForm.ShowDialog();
            if (loginResult == DiaglogResult.OK)
            {
            // The login was OK. Enable the controls as needed.
            }
            else
            {
            // The login failed. Disable the controls as needed.
            // Or might want to quit the application.
            }

            RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            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