foreach (System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ; }
}
编程遍历WinForm页面上所有TextBox控件并给它赋值为string.Empty
最新推荐文章于 2023-07-12 13:44:08 发布
博客给出一段代码,通过foreach循环遍历窗体中的控件,判断若为文本框,则将其文本内容清空,是信息技术领域关于窗体控件操作的代码示例。
285

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



