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

在使用VS2005进行MFC开发时,遇到添加控件事件时出现‘无法执行添加移除操作,因为代码元素是只读的’错误。通过删除.ncb和.suo文件,重建项目等待IntelliSense完成,可以解决该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在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#

转载于:https://www.cnblogs.com/good90/archive/2012/03/04/2379238.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值