我想进行以下判断:
private string JudgeControl(Control ctl)
{
System.Type type = ctl.GetType(); switch (type)
{
case ?:
return "TextBox";
break;
case ?:
return "ComboBox";
}
}“?”应该替换成什么才正确?
private string JudgeControl(Control ctl)
{
System.Type type = ctl.GetType(); switch (type)
{
case ?:
return "TextBox";
break;
case ?:
return "ComboBox";
}
}“?”应该替换成什么才正确?
System.windows.Form.ComboBox
{
System.Type type = ctl.GetType();
return type.Name;
}
应输入整型值
这样写:
if (ctl.GetType().ToString == "System.Windows.Forms.ComboBox")
if(ctl.GetType() == typeof(System.Windows.Forms.ComboBox))