C# Winform检查所有textBox内容是否为空--采用控件数据方式

 1 foreach(Control c in this.Controls)
 2 {
 3   if (c is TextBox)
 4   {
 5     if (string.IsNullOrEmpty((c as TextBox).Text))
 6     {
 7       MessageBox.Show("请正确填写内容,带*为必填内容");
 8       return;
 9     }
10   }
11 }

 

posted @ 2016-04-01 10:25  lyycn  阅读(1926)  评论(0编辑  收藏  举报