Check Whether a TextBox is empty or not
I think
string.IsNullOrEmpty(TextBox.Text)
or
string.IsNullOrWhiteSpace(TextBox.Text)
are your best options.
You should use String.IsNullOrEmpty()
to make sure it is neither empty nor null (somehow):
if (String.IsNullOrEmpty(textBox1.Text))
{
// Do something...
}
More examples here.
For practical purposes you might also consider using String.IsNullOrWhitespace()
since a TextBox expecting whitespace as input probably negates any purpose, except in case of, say, letting the user pick a custom separator for stuff.