Check if TextBox Is Empty in C#
In C#, there are multiple ways to check if TextBox value is not empty:1) Using String.IsNullOrEmpty() method.
2) Using TextBox.Text.Length property.
You can use below examples in any method.
Example using String.IsNullOrEmpty() method
if (String.IsNullOrWhitespace(textBox1.Text))
{
label1.Text = "TEXT BOX IS EMPTY";
}
Example using TextBox.Text.Length property
if (textBox1.Text.Length == 0)
{
label1.Text = "TEXT BOX IS EMPTY";
}