为了清除我的文本框,我用以下代码表格:
foreach (Control c in this.Controls)
{
if (c is TextBox || c is RichTextBox)
{
c.Text = "";
}
}
但现在我的文字框位于 Tab Control 内。 我怎样才能对文字框进行同样的检查, 如果控制是文本框, 请将值设为“ ” 。 我已经尝试过使用 :
foreach(Control c in tabControl1.Controls)
但是,这没有奏效。