private void btn清空_Click(object sender, EventArgs e)
{
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
((TextBox)control).Clear();
}
}
}
{
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
((TextBox)control).Clear();
}
}
}
本文介绍了一个简单的方法来清空Windows窗体应用程序中所有的TextBox控件内容。通过遍历窗体上的控件并检查其类型,可以有效地清除所有输入框中的数据。
742

被折叠的 条评论
为什么被折叠?



