Thursday, December 15, 2011

Allow only LETTERS and Backspace in a textbox

Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress

If (e.KeyChar >= "a" And e.KeyChar = "A" And e.KeyChar
e.Handled = False

Else
e.Handled = True
MessageBox.Show("Only Letters")

End If
End Sub

No comments:

Post a Comment