Validation

crazymarvin

Member
Joined
Nov 22, 2006
Messages
18
Location
Belfast, UK
Programming Experience
Beginner
hey, I need some help with this:
VB.NET:
    Private Sub txtboxName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtboxName.TextChanged
        If txtboxName.Text = "" Then Exit Sub
        CustomerName = txtboxName.Text
        If IsNumeric(CustomerName) = True Then
            MessageBox.Show("You have to enter a vaild name in this field", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            txtboxName.Undo()
        End If

    End Sub
it will only display the warning message if the 1st number you enter is a number, but it will let you type something like 'martyn1234', any idea's why? or how i can get it to display the message if there are any numbers in the text box?

'CustomerName' is publicly defined as a string on a module, if that is revelant

thanks, Martyn
 
"m.." isn't numeric. Check all characters if you don't want to allow a digit character.
 
Back
Top