views:

186

answers:

2

I have a MFC dialog in Visual C++ 2005, (MFC Application) and I have added several controls to it. But Visual Studio has no option for deleting a control if I no longer need it. Is there any easy way to do that except modifying all the code where a reference to the control appears?

A: 

I'm pretty sure selecting the offending control on the design sheet and pressing delete works?

Patrick
It does, but doing so leaves behind portions of code in the header and cpp files, and you will get a pretty ugly error 99% of the time. I was thinking about deleting the control and all code associated with it.
Ove
I've never got an error, the code remaining is a feature :)
Patrick
+2  A: 

There is no way to automatically remove all related code. One method that can help the manual removal is to use "Find all references" before removing the object in the designer. Then after deleting it, navigate to the references and remove the related code.

Aidan Ryan