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. Deleted VS component

Deleted VS component

Scheduled Pinned Locked Moved C#
visual-studiocsharpdesignquestion
3 Posts 2 Posters 1 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.
  • H Offline
    H Offline
    Hans Ruck
    wrote on last edited by
    #1

    Hi, Is there a way to determine that a custom Visual Studio component has been deleted from a form at design time? I am currently working on such a component.

    online

    H 1 Reply Last reply
    0
    • H Hans Ruck

      Hi, Is there a way to determine that a custom Visual Studio component has been deleted from a form at design time? I am currently working on such a component.

      online

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      The only two things that occur to me are: 1) It might (that's a very big might) be possible to override the OnControlRemoved method of your Form, test for DesignMode and then check if the ControlEventArgs.Control is your control. I'm not even sure that the method gets called at Design time, you'd have to check that for yourself. You would also conceivably have to do this for every container control on the Form. 2) Another possibility is to override the Dispose method of your control, or write a Destructor, and handle things there. Again, you'd have to test for DesignMode. These two options may be either impossible or unfeasable. I'm pretty sure that others will tell me if I have it totally wrong, but that is where I would start investigating if it were my project.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      H 1 Reply Last reply
      0
      • H Henry Minute

        The only two things that occur to me are: 1) It might (that's a very big might) be possible to override the OnControlRemoved method of your Form, test for DesignMode and then check if the ControlEventArgs.Control is your control. I'm not even sure that the method gets called at Design time, you'd have to check that for yourself. You would also conceivably have to do this for every container control on the Form. 2) Another possibility is to override the Dispose method of your control, or write a Destructor, and handle things there. Again, you'd have to test for DesignMode. These two options may be either impossible or unfeasable. I'm pretty sure that others will tell me if I have it totally wrong, but that is where I would start investigating if it were my project.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        H Offline
        H Offline
        Hans Ruck
        wrote on last edited by
        #3

        Thank you for the reply. I need a design time solution, independent of the container form. Trying the second solution didn't work. The Dispose is called also when the form is closed during the design time.

        Bogdan.

        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