读书人

C#中tablecontrol 检察里边的tabletex

发布时间: 2013-03-22 09:49:50 作者: rapoo

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;
}
}
}

}

thank in advance!
[解决办法]
不是跟这个类似么?

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;


}
}


[解决办法]
引用:
引用:不是跟这个类似么?
C# code?12345678910foreach (Control control in tabPage1.Controls) { if (control.Text.Length <= 0 && control is T……


不明白你的意思,进不去是何解?
[解决办法]

private void c()
{
foreach (Control ctl in this.Controls)
{
if (ctl is TabControl)
{
foreach (Control tab in ctl.Controls)
{

}
}
}
}

读书人网 >C#

热点推荐