0

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.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

2 Answers2

1

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.)

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188
0

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

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862