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. How to catch an event when UserControl disposing.

How to catch an event when UserControl disposing.

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

    How to manage an event like OnClose, to do some actions before the moment some UserControl close. I need to have a way to cancel Closing. Thanx.

    Mike HankeyM 1 Reply Last reply
    0
    • S Salogus

      How to manage an event like OnClose, to do some actions before the moment some UserControl close. I need to have a way to cancel Closing. Thanx.

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #2

      The cancel has to be done at the form level and you use the OnClosing and setting the e.Cancel property to true. Good luck!

      Theres light at the end of the tunnel, hope it ain't no train.

      S 1 Reply Last reply
      0
      • Mike HankeyM Mike Hankey

        The cancel has to be done at the form level and you use the OnClosing and setting the e.Cancel property to true. Good luck!

        Theres light at the end of the tunnel, hope it ain't no train.

        S Offline
        S Offline
        Salogus
        wrote on last edited by
        #3

        So, I handle OnClosing for a Form, and check all UserControls, belonging to the Form, for some state. If the state is not "right", I set e.Cancel to true. Ok... But how I can reach all UserControls belonging to the Form if I have nested containers like TabPages and Panels?

        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