views:

48

answers:

2

I need to change a lot of textboxes to NumericUpDowns and other similar changes on some forms in my multiform c# app. I'd like to keep the name of each control the same as I make the change. There's also code for events associated with some of the controls that I'd like to change as little as possible.

How do I do this without screwing things up badly in Visual Studio? It's version 2008. I'm worried I'll surely run into the dreaded designer errors.

+2  A: 

Make the changes in the designer.cs file, and keep your fingers crossed :)

PaulG
I was hoping to avoid that. ;-)
Dave
i don't see any other intelligent way neither. unfortunately this is the fastest possibility. depending on the changes, this may fail. but mostly, only small problems need to be expected. don't forget to make a copy of the entire project before trying this ;o)
Atmocreations
+2  A: 

This might make it slightly less painful:

Create a new class, derived from TextBox (let's call it MyClass). Change all of the occurrences of TextBox that you want to change, via the search and replace method. Then you can change MyClass and derive it from NumericUpDown, and see if anything breaks.

Your only alternative is to create a class that is derived directly from either TextBox or NumericUpdown, and then implement methods compatible with the other one. So in effect you would have a control that is compatible with both NumericUpDown and TextBox.

HiredMind