intAnswer[intID - 1] = Convert.ToInt32(((RadioButton)sender).Tag);
strAnswer[intID - 1] = ((RadioButton)sender).Text.Trim();这两句运行会提示:
无法将类型为“System.Windows.Forms.Panel”的对象强制转换为类型“System.Windows.Forms.RadioButton”。
但并不是每次都提示,这是什么原因啊?C#
strAnswer[intID - 1] = ((RadioButton)sender).Text.Trim();这两句运行会提示:
无法将类型为“System.Windows.Forms.Panel”的对象强制转换为类型“System.Windows.Forms.RadioButton”。
但并不是每次都提示,这是什么原因啊?C#
解决方案 »
- c#Helpppppppppppppp
- 【求救】有关循环执行的问题
- 关于中国移动mas机的配置
- 程序互斥怎么做?我用System.Threading.Mutex mutex = new System.Threading.Mutex(false, "1111213213508")没效果.内详
- 关于 无法绑定到新的显示成员
- 菜鸟提问莫见笑,关于如何得到源代码
- C#如何实现定时启动程序?
- 托动窗口!怎么做?
- SOS,.net Framework beta2真的有问题的。我该怎么办(javanow)
- Winform在事件方法外给datagridview数据绑定失败是为什么
- XmlDocument和XDocument,创建多个xml文件的难题!!!!!
- WPF,求MVVM的好书
如果你要用sender你要确保你的这个事件是randiobutton传过来的
strAnswer[intID - 1] = ((RadioButton)sender).Text.Trim();你上边语句中的sender是谁?
((RadioButton)sender).Text.Trim();你这个sender应该是Panel控件,无法强制转换这不都明说了,直接用RadioButton就行了