Text box validation not working

前端 未结 7 1441
[愿得一人]
[愿得一人] 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:49

    There are various Validation possibilities, maybe have a look at this.

    Else you can use something like

    if (txtFirstName.Text == "" && txtFirstName.Text.indexOf(" ") == -1)

    which checks for whitespaces :)

提交回复
热议问题