BPak Active Member Licensed User Longtime User Apr 30, 2007 #1 I want to check the key input for the Text Box so as to prevent a user entering wrong letters or numbers. B4X: 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?
I want to check the key input for the Text Box so as to prevent a user entering wrong letters or numbers. B4X: 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?
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2007 #2 You should use the IgnoreKey method. B4X: Sub RceEd_KeyPress (key) MsgBox(key) if key = "2" then RceEd.IgnoreKey End Sub
You should use the IgnoreKey method. B4X: Sub RceEd_KeyPress (key) MsgBox(key) if key = "2" then RceEd.IgnoreKey End Sub