首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#中tablecontrol 检察里边的tabletext为空

2013-03-22 
C#中tablecontrol 检查里边的tabletext为空界面中有个tablecontrol 里边有两个页面tablepage 现在要求检查

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 &amp;amp;&amp;amp; control is T……


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

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

热点排行