相关疑难解决方法(0)

如何清除表单中所有textBox的文本?

private void CleanForm()
{
    foreach (var c in this.Controls)
    {
        if (c is TextBox)
        {
            ((TextBox)c).Text = String.Empty;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

上述方法不起作用,并且不清除控件.编译很好,但什么都不做.

有任何想法吗?

c# textbox winforms

20
推荐指数
3
解决办法
11万
查看次数

标签 统计

c# ×1

textbox ×1

winforms ×1