private void btnClear_Click(object sender?? EventArgs e)
{
ClearCntrValue(this.pnlContent);
}
[csharp] view plaincopyprint?
/// <summary>
/// ????????????Щ??????
/// </summary>
/// <param name="parContainer">????????</param>
public void ClearCntrValue(Control parContainer)
{
for (int index = 0; index < parContainer.Controls.Count; index++)
{
// ????????????????????????
if (parContainer.Controls[index].HasChildren)
{
ClearCntrValue(parContainer.Controls[index]);
}
else
{
switch(parContainer.Controls[index].GetType().Name)
{
case "TextBox":
parContainer.Controls[index].Text = "";
break;
case "RadioButton":
((RadioButton)(parContainer.Controls[index])).Checked = false;
break;
case "CheckBox":
((CheckBox)(parContainer.Controls[index])).Checked = false;
break;
case "ComboBox":
((ComboBox)(parContainer.Controls[index])).Text = "";
break;
}
}
}
}

??????????????C# WinForm???????????С????????????????????