Question

I'm using a custom control I created derived from DataGridView in an app.

If I change the source code for this custom control, do I need to remove my control from the form and then add back to the rebuilt version of it from the toolbox?

I hope not, as that would be quite tedious - resetting all the properties, hooking up events, etc.

Was it helpful?

Solution

No, there is no special magic going on with controls in winforms. They are created like normal objects each time you create the form mySuperControl1 = new MySuperControl();. So you will always get a control which is up to date. Even in the designer. (It is better to close the designer of forms containing this control, when changing the control. The control might become temporarly unavailable when it cannot compile or its code is broken for some reason.)

OTHER TIPS

Apparently it is not necessary, fortunately. I commented out a bit of code, and sure enough, it didn't execute, so...good!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top