如何解决无法将System.Windows.Forms.Label强制转换为Radiobutton的问题 [英] How Solve unable to cast System.Windows.Forms.Label to Radiobutton
本文介绍了如何解决无法将System.Windows.Forms.Label强制转换为Radiobutton的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string pDetails = string.Empty;
foreach (RadioButton rb in gpPaymntdetl.Controls)
{
if (rb.Checked == true)
{
pDetails += Convert.ToInt16(rb.Name);
break;
}
}
objBll.BltPayDetails = pDetails.ToString();
推荐答案
您必须尝试这样.
You have to try like this.
string pDetails = string.Empty;
foreach (Control c in gpPaymntdetl.Controls)
{
if (c.GetType().ToString().Equals("Sys.Windows.Forms.RadioButton"))
{
if(((RadioButton)c).Checked == true)
{
pDetails += Convert.ToInt16(((RadioButton)c).Name);
break;
}
}
}
objBll.BltPayDetails = pDetails.ToString();
这篇关于如何解决无法将System.Windows.Forms.Label强制转换为Radiobutton的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文