Cannot add event handler because code element marked as read-only

今天在VS2005下用MFC准备给一control button添加控件事件,双击提示“无法执行添加移除操作,因为代码元素“CODBCDLG”是只读的”,

打开google一搜索,具体原因还不太清楚,可能是vs的bug,解决方法如下:

“I run into this problem a couple of times a month.

Workaround: Delete the .ncb and .suo files. Rebuild all. Wait for Intellisense to complete. 

I had a button control I was trying to add an event handler to.
In the resource view of the dialog box I was working on, I then double-clicked the button. Took FOREVER with nearly 100% cpu time being used for the system to do whatever it does. But if you wait it out, your source code will eventually show up with the "OnBnClicked..." function installed as it normally would have had you not run into the bug...”

 author:good90

更详细参考:http://connect.microsoft.com/VisualStudio/feedback/details/105469/cannot-add-event-handler-because-code-element-marked-as-read-only#

posted @ 2012-03-04 14:30  good90  阅读(233)  评论(0编辑  收藏  举报