private void InputClear(Control EditArea)
{
foreach (Control Ctrl in EditArea.Controls)
{
if (Ctrl.GetType().Equals(typeof(TextBox)))
{
Ctrl.Text = "";
}
if (Ctrl.GetType().Equals(typeof(ComboBox)))
{
ComboBox cmb = (ComboBox)Ctrl;
cmb.SelectedIndex = 0;
}
if (Ctrl.GetType().Equals(typeof(DateTimePicker)))
{
DateTimePicker dtp = (DateTimePicker)Ctrl;
dtp.Value = DateTime.Now;
}
}
}
根据需要把所有可能用到的控件添加进去
重置输入区域控件的公用方法
时间: 2024-10-15 00:09:50