C#中tablecontrol 检查里边的tabletext为空
界面中有个tablecontrol 里边有两个页面tablepage 现在要求检查tabpage1中的值是否为空 一个一个检查很麻烦 我想用类似这样的检查,不知道该怎么进入判断
foreach (System.Windows.Forms.Control ctr in this.Controls)
{
if (ctr is GroupBox)
{
foreach (Control ctr1 in ctr.Controls)
{
if (ctr1.Text.Length <= 0 && ctr1 is TextBox && !ctr1.Name.ToString().EndsWith("Dataname"))
{
toolStripStatusLabel1.Text = "請輸入" + ctr1.Name.ToString();
ctr1.Enabled = true;
break;
}
}
}
}
foreach (Control control in tabPage1.Controls)
{
if (control.Text.Length <= 0 && control is TextBox && !control.Name.ToString().EndsWith("Dataname"))
{
toolStripStatusLabel1.Text = "請輸入" + control.Name.ToString();
control.Enabled = true;
control.Focus();
break;
}
}
private void c()
{
foreach (Control ctl in this.Controls)
{
if (ctl is TabControl)
{
foreach (Control tab in ctl.Controls)
{
}
}
}
}