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. .NET (Core and Framework)
  4. Handlers removed automatically?

Handlers removed automatically?

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpwpfwinformsdockerhelp
2 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.
  • D Offline
    D Offline
    divyesh1432
    wrote on last edited by
    #1

    Hi, In winforms or wpf application, lets say there is one container control which adds controllers dynamically and it also adds event handlers of that child controls. Now if I call a clear method of the parent container control, will the event handlers added be removed automatically? If not and I dont remove them (event handlers), will it create any other issue? Please suggest! Thanks, Divyesh

    L 1 Reply Last reply
    0
    • D divyesh1432

      Hi, In winforms or wpf application, lets say there is one container control which adds controllers dynamically and it also adds event handlers of that child controls. Now if I call a clear method of the parent container control, will the event handlers added be removed automatically? If not and I dont remove them (event handlers), will it create any other issue? Please suggest! Thanks, Divyesh

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      when you clear a container control, it disposes of all the contained controls; each control will be available for garbage collection, and the event members they contain will have no influence, just like any other data members. There is no need to remove handlers at all. BTW: The same applies to a modeless form that gets closed. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      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