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. EventHandler for Child Form Closed Event?

EventHandler for Child Form Closed Event?

Scheduled Pinned Locked Moved C#
questionhelp
3 Posts 2 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
    alanteigne
    wrote on last edited by
    #1

    In my project I've created an instance of a custom form class. In my form class, I have error detection that simply closes the form if an un-handleable error occurs. Due to the nature of the app, this is the desired behavior. However, I would like an event on the main form to fire off whenever this happens. How can I do this? I initialize my custom for like this: frm_myForm myForm = new frm_myForm(); For any other control I want to add a handler for, I would do something like this: btnShowForm.Click += new System.EventHandler(btnShowForm_Click); ... and create the corresponding function. I applied similar logic to my form instance but it doesn't seem to work that way. (myForm.Closed += new blah blah). Am I missing a key concept here? It seems like this would be functionality used all the time so I fear I'm being dense and not seeing the big picture. Any advice is appreciated... Alan

    L 1 Reply Last reply
    0
    • A alanteigne

      In my project I've created an instance of a custom form class. In my form class, I have error detection that simply closes the form if an un-handleable error occurs. Due to the nature of the app, this is the desired behavior. However, I would like an event on the main form to fire off whenever this happens. How can I do this? I initialize my custom for like this: frm_myForm myForm = new frm_myForm(); For any other control I want to add a handler for, I would do something like this: btnShowForm.Click += new System.EventHandler(btnShowForm_Click); ... and create the corresponding function. I applied similar logic to my form instance but it doesn't seem to work that way. (myForm.Closed += new blah blah). Am I missing a key concept here? It seems like this would be functionality used all the time so I fear I'm being dense and not seeing the big picture. Any advice is appreciated... Alan

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      alanteigne wrote:

      frm_myForm myForm = new frm_myForm();

      myForm.FormClosed += new FormClosedEventHandler(myForm_FormClosed);

      A 1 Reply Last reply
      0
      • L led mike

        alanteigne wrote:

        frm_myForm myForm = new frm_myForm();

        myForm.FormClosed += new FormClosedEventHandler(myForm_FormClosed);

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

        FormClosed. You've gotta be kidding me, that makes too much sense! Thanks!

        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