Custom Search
Your Ad Here
Latest News
Showing posts with label VB.NET accept only characters. Show all posts
Showing posts with label VB.NET accept only characters. Show all posts

VB.NET accept only characters

Posted by Gregfox on 9/23/08 , under | comments (0)



Public Function ValidChars(ByRef myEmail As String) As Boolean

Dim isValidE As Boolean = False

If myEmail <> String.Empty Then

If (System.Text.RegularExpressions.Regex.IsMatch(myEmail, "[A-Za-z]", RegexOptions.IgnoreCase)) Then
isValidE = True
End If
End If

Return isValidE
End Function

Private Sub txtCILastName_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtCILastName.Validating
If ValidChars(txtCILastName.Text) Then

Else
MessageBox.Show("Invalid Character.", "Character Validator", MessageBoxButtons.OK, MessageBoxIcon.Warning)
txtCILastName.Focus()
End If
End Sub
javascript:void(0)