您好,像这样情况,还有其他快速获取每个相应的控件值的方法吗?(里面的控件都是自定义的,通过代码加进去的)
代码: for (int i = 0; i < panel1.Controls.Count; i++)
{
string type = panel1.Controls[i].ToString();
if (type == "SmobilerApplication1.UserControl.UserTextBox")
{
UserTextBox tp = panel1.Controls[i] as UserTextBox;
if (tp.Name == "csysbarcode") {
csysbarcode = tp.textContent;
}
}else if(type == "SmobilerApplication1.UserControl.datetime_UControl"){
datetime_UControl td = panel1.Controls[i] as datetime_UControl;
if(td.Name=="dpodate")
{
dpodate = td.sValue.ToString();
}
}
} |