Hi Community,
as number pad has no return / done button I am using the code from this thread to be able to have numeric values in the text field.
This is working when i entered 2 characters. It is not working when I enter only 1 character.
Is it possible to have this working when also entering only one char or did I have made something wrong?
Best regards
--Christian
as number pad has no return / done button I am using the code from this thread to be able to have numeric values in the text field.
B4X:
Private Sub txtNumberNumber_TextChanged (Old As String, New As String)
Dim update As Boolean
Try
Dim text As String = Regex.Replace("\D", New, "")
If New <> text Then
update = True
End If
Catch
Log(LastException.Message)
End Try
If text.Length > 3 Then
text.SubString2(0,3)
update = True
End If
If update Then
txtNumberNumber.Text = text
txtNumberNumber.SetSelection(text.Length,text.Length)
End If
End Sub
This is working when i entered 2 characters. It is not working when I enter only 1 character.
Is it possible to have this working when also entering only one char or did I have made something wrong?
Best regards
--Christian