Asa*_*sad 14
你需要编写,并呼吁类似的function后submit
public static void EmptyTextBoxes(Control parent)
{
foreach (Control c in parent.Controls) {
if (c.GetType() == typeof(TextBox))
{
((TextBox)(c)).Text = string.Empty;
}
}
}
Run Code Online (Sandbox Code Playgroud)
参考
http://www.tek-tips.com/faqs.cfm?fid=6470
这用于清除表单中的所有控件,如文本框、复选框、单选按钮
你可以添加你想要的不同类型..
private void ClearTextBoxes(Control control)
{
foreach (Control c in control.Controls)
{
if (c is TextBox)
{
((TextBox)c).Clear();
}
if (c.HasChildren)
{
ClearTextBoxes(c);
}
if (c is CheckBox)
{
((CheckBox)c).Checked = false;
}
if (c is RadioButton)
{
((RadioButton)c).Checked = false;
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43296 次 |
| 最近记录: |