获取界面所有的TextBox

foreach (Control txtobj in this.PMain.Controls)
{
if (txtobj is TextBox)     //if(txtobj is Button)
{
if (string.IsNullOrEmpty(txtobj.Text))
{
MsgBox.MsgInfo("界面数据不能为空,请检查!");
return;
}
}
}

原文地址:https://www.cnblogs.com/AbelAngelo/p/13141020.html