How can I limit text length in TextField, for example to max 4 characters. Also I need to limit TextField to numbers only?
EDIT:
Solution if someone need it, with 3 characters limit:
B4X:
Sub txt1_TextChanged (Old As String, New As String)
Dim sb As StringBuilder
sb.Initialize
For i = 0 To New.Length - 1
If "0123456789".IndexOf(New.CharAt(i)) > -1 Then
sb.Append(New.CharAt(i))
End If
Next
If sb.ToString.Length > 3 Then
txt1.Text = sb.ToString.SubString2(0,3)
Else
txt1.Text = sb.ToString
End If
txt1.SetSelection(txt1.Text.Length, txt1.Text.Length)
End Sub