110,534
社区成员
发帖
与我相关
我的任务
分享
Control c = null;
switch(controlType.ToUpper())
{
case "BUTTON": c = new Button(); break;
case "TEXTBOX": c = new TextBox(); break;
case "LABEL": c = new Label(); break;
default: throw new Exception("Unrecognized control type: " + controlType);
}
c.Text = controlText;
...