Text box validation not working

前端 未结 7 1408
[愿得一人]
[愿得一人] 2020-12-12 07:40

Right now the code below tests for a blank text box. If it is blank it returns the error stated below the if statement. That works fine, but I also want it to check for wh

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 07:56

    String.IsNullOrWhiteSpace returns true for a null string or a string that is purely whitespace For example " ".

    If you do not want to allow spaces in the string ie ("B ike") test the string value for spaces using Contains(' ').

提交回复
热议问题