Deleted VS component
-
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
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 forDesignMode
and then check if theControlEventArgs.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 theDispose
method of your control, or write aDestructor
, 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.”
-
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 forDesignMode
and then check if theControlEventArgs.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 theDispose
method of your control, or write aDestructor
, 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.”