Add/Remove operation is impossible, the code element Cxxx is read only

less than 1 minute read

 

When attempting to add a Control Event Handler to a control on a dialog, we are encountering the message: Add/Remove operation is impossible, the code element 'Cxxx' is read only.

After an hour of trying to solve it my self, a quick Google search turned up the following solutions.

  • Add random charters to the .h/.cpp file
  • clean your solution
  • Close all open windows and close the project.
  • Delete .ncb and .suo files
  • Open your project solution and rebuild
  • Attempt to add your new control event handler.

This seemed to work for me with

Microsoft Visual studios 2009
Version 9.0.21022.8 RTM

Source: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99076

Leave a comment