I am trying to validate the number of characters placed inside a TextBox but am having some trouble. The code I'm using is as follows:
If Not ((TextBox5.Text.Length) <= 1) Or ((TextBox5.Text.Length) >= 10) Then MsgBox("Invalid date entry. Use the the following format: DD-MM-YYYY.") TextBox5.Focus() TextBox5.SelectAll() Else 'do whatever End If What I want is for TextBox5 to have a length between (and inclusive) 1 and 10, if not reselect the TextBox making it ready for another user input.
The code responds well for an input less than 1 but fails to recognise any input larger than 10 characters. I can't see what i'm doing wrong?
Notpart