Validate TextBox entry


Active Member
Licensed User
Longtime User
I want to check the key input for the Text Box so as to prevent a user entering wrong letters or numbers.

Sub RceEd_KeyPress (key)
'   MsgBox(key)
'   if key = "2" then key = ""
'   tmp = RceEd.Text
'   if key = "2" then RceEd.Text = tmp
End Sub

Tried the two ways shown in code but does not work for.

Any examples on this method please?