Private Sub txtLastName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastName.TextChanged If Not Regex.Match(txtLastName.Text, "^[a-z]*$", RegexOptions.IgnoreCase).Success Then MessageBox.Show("Please enter alphabets only", "Add Contact", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) txtLastName.Focus() End If End Sub
^[a-zA-Z0-9]+$
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)