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. mdi parent problem

mdi parent problem

Scheduled Pinned Locked Moved C#
help
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.
  • M Offline
    M Offline
    monuSaini
    wrote on last edited by
    #1

    Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini

    J L 2 Replies Last reply
    0
    • M monuSaini

      Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini

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

      Something like DialogResult result = LoginForm.Dialog If (result == DialogResult.Cancel) this.Close();(or Application.Exit();) else ....

      1 Reply Last reply
      0
      • M monuSaini

        Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini

        L Offline
        L Offline
        Larantz
        wrote on last edited by
        #3

        Have you done anyting according to this:

        DialogResult result = loginForm.ShowDialog();
        if(result == DialogResult.Ok)
        {
        //code for checking credentials or what ever...
        }
        else if(result == DialogResult.Cancel)
        {
        //User cancelled login. Close MDI parent.
        this.Close();
        }

        or else you might try in loginforms cancel button clicked event:

        public void buttonCancel_OnClicked(object sender, EventArgs e)
        {
        (this.Parent as Form).Close(); //Not sure if you can close parent from child.
        this.Close();
        }

        -Larantz

        for those about to code, we salute you
        http://www.tellus-software.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