Custom Search
Your Ad Here
Latest News

VB.NET accept only characters

9/23/08 , Posted by Gregfox at 10:17 PM

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)

Currently have 0 comments:

Leave a Reply

Post a Comment