C Method for Determining If Multiple Text Boxes Are Empty

  • 2021-07-01 08:07:07
  • OfStack

This article illustrates the method of C # to determine whether multiple text boxes are empty. Share it for your reference. The specific implementation method is as follows:


/// <summary>
///  Customize the method to judge the project txt Whether the label is empty 
/// </summary>
/// <param name="txt"> Tag to be judged as empty </param>
/// <returns> Whether all of them are not empty, and if all of them are not empty, return  true </returns>
bool CheckEmpty(params TextBox[] txt)
{
bool flag = true;
for (int i = 0; i < txt.Length; i++)
{
if (txt[i].Text.Trim() == "")
{
MessageBox.Show(" Marked as  *  The option of cannot be blank, please re-enter! ");
txt[i].Focus();
flag = false;
break;
}
}
return flag;
}

I hope this article is helpful to everyone's C # programming.


Related articles: