How to validate a blank maskedtextbox?

Asked

Viewed 129 times

0

In case the maskedtextboxTEL (00)0000-0000 would return a error provider and would not proceed until it has been completed.

1 answer

0

You can use the método String.Isnullorwhitespace.

Code

 if (String.IsNullOrWhiteSpace(txt_Telefone.Text))
 {
    errorProvider1.SetError(txt_Telefone, "Preencha o telefone ! ");
 }
  • I think it will not work, if it is a Mask, will have come the . Text filled with (00) 0000-0000

  • hmm.. worse than and even in ... think I should keep the answer ? after all is validating a blank content right . the worst that the questioner seems to have abandoned the site = (. I took into consideration more by the title of the question itself.

  • Let’s wait and see what the questioner said.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.