How can i write code or change the below code so that my text box either takes numerical values or can take alphabets(A-Z),but alphanumerical values not allowed
'only numerical checking code
Private Sub txtSets_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSets.KeyPress
If Not IsNumeric(e.KeyChar) And Not e.KeyChar = Chr(8) Then
e.KeyChar = ""
Er:
MsgBox("Only Numeric values allowed", vbCritical, Title:="Only Numerical Values")
End If
'Function for Handling Dot when it is entered 2 times in the text box
If (Char.IsControl(e.KeyChar) Or Char.IsDigit(e.KeyChar) = True) Then
If txtSets.Text.IndexOf(".") <> -1 And e.KeyChar = "." Then
e.Handled = True
End If
Else
e.Handled = True
End If
End Sub