【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
((RadioButton)(this->Controls[j])->Controls[m]).Checked = true;
RadioButton ^rb = dynamic_cast<RadioButton ^>(this->Controls[j]->Controls[m]);
rb->Checked = true;