foreach (Control control in Controls) { if (control is TextBox) { ((TextBox)control).Text = string.Empty; } }
foreach (Control control in this.Controls) { if (control is TextBox) { ((TextBox)control).Text = ""; } }
foreach (Control control in this.Controls) { if (control is TextBox) { ((TextBox)control).Text = ""; } } 我以前也写得这个,可是报错!我就又改了一下,改成((TextBox)control).Text.Equals (""); 可是还报错!现在改成 foreach (Control control in Controls) { if (control is TextBox) { ((TextBox)control).Text = string.Empty; } } 不报错了,但是实现不了重置!
((TextBox)control).Text = "";
{
if (control is TextBox)
{
control.Text.Equals ("");
} }
应该这样吧?
按你们的都改了,还这样报错!
{
if (control is TextBox)
{
((TextBox)control).Text = string.Empty;
}
}
{
if (control is TextBox)
{
((TextBox)control).Text = "";
}
}
{
if (control is TextBox)
{
((TextBox)control).Text = "";
}
}
我以前也写得这个,可是报错!我就又改了一下,改成((TextBox)control).Text.Equals ("");
可是还报错!现在改成 foreach (Control control in Controls)
{
if (control is TextBox)
{
((TextBox)control).Text = string.Empty;
}
}
不报错了,但是实现不了重置!