首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

【100】VS2005 C++ (RadioButton)强制转换为RadioButton失败

2013-01-06 
【100求救】VS2005 C++ (RadioButton)强制转换为RadioButton失败我的代码中有这一句:613行:((RadioButton)th

【100求救】VS2005 C++ (RadioButton)强制转换为RadioButton失败
我的代码中有这一句:
613行:


((RadioButton)this->Controls[j]->Controls[m]).Checked = true;

编译时提示错误如下:

1>e:\modifydata\modifydata\Form1.h(613) : error C2440: 'type cast' : cannot convert from 
'System::Windows::Forms::Control ^' to 'System::Windows::Forms::RadioButton'
1>        Conversion requires a constructor or user-defined-conversion operator, which can't be 
used by const_cast or reinterpret_cast
1>e:\modifydata\modifydata\Form1.h(613) : error C2101: '&' on constant
1>e:\modifydata\modifydata\Form1.h(613) : error C2101: '&' on constant
1>e:\modifydata\modifydata\Form1.h(613) : error C2101: '&' on constant
1>e:\modifydata\modifydata\Form1.h(613) : error C2100: illegal indirection


我的程序效果如图:

一个窗体上有几个groupbox,每个groupbox中有几个RadioButton


请问为什么不能转换呢?在线等各位帮助
如果这句话有错,我应该怎么设置单选按钮选中呢
需要更全的代码吗
[解决办法]
((RadioButton)(this->Controls[j])->Controls[m]).Checked = true;


括号有问题
[解决办法]


RadioButton ^rb = dynamic_cast<RadioButton ^>(this->Controls[j]->Controls[m]);
 rb->Checked = true;

热点排行