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. Free resources of user control

Free resources of user control

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
4 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.
  • R Offline
    R Offline
    Robert Rohde
    wrote on last edited by
    #1

    Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert

    H G 2 Replies Last reply
    0
    • R Robert Rohde

      Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert

      H Offline
      H Offline
      Hayder Marzouk
      wrote on last edited by
      #2

      Hi, When a form is disposed, all child controls are disposed. So you have hust to dispose the form. HTH.

      1 Reply Last reply
      0
      • R Robert Rohde

        Hi, I'm having a user control in .Net 2.0 created with Visual Studio 2005. Where would you place cleanup code? I ask because the partial file of the designer contains the Dispose method where I normally placed my cleanup code. But generally I'm trying to avoid to manually change the code of the Designer.cs files. What are the common practices concerning this? Robert

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        You can use the Disposed event to add an event handler that will be called when the controls is being disposed.

        --- single minded; short sighted; long gone;

        R 1 Reply Last reply
        0
        • G Guffa

          You can use the Disposed event to add an event handler that will be called when the controls is being disposed.

          --- single minded; short sighted; long gone;

          R Offline
          R Offline
          Robert Rohde
          wrote on last edited by
          #4

          Good point. Should have thought of this myself. Although I normally try to override base functions instead of binding events in the user control/form itself this sound good in this particular case where the Dispose method is already overriden in the Designer code. Thanks. Robert

          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