How can I check in C# that is there a white space only in a textbox and perform some operation after that?
This ensures multiple spaces are caught in your check.
bool hasAllWhitespace = txtBox1.Text.Length>0 &&
txtBox1.Text.Trim().Length==0;
To check for a single space only:
bool hasSingleWhitespace = txtBox1.Text == " ";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With