Hi mate I had a quick look through the documentation and it doesn't mention length as a property, maybe you could try something like string length using the edittext textchanged event
edittext1.text = string
if string.length = "3" then
edittext1.enabled = false
else
next if
Sub txtTruckNumber_TextChanged (Old As String, New As String)
If New.Length>19 Then
txtTruckNumber.text= New.SubString2(0,19)
txtTruckNumber.SelectionStart=19
EndIf
End Sub
The selectionStart keeps the cursor at the end of the textbox
I re-open this thread because I want to contribute with my solution, for me better than post #4, because it works better with SelectionStart when you change text at the middle of EditText
B4X:
Sub txtTruckNumber_TextChanged (Old As String, New As String)
If New.Length > 19 Then
Dim pos As Int = Codice.SelectionStart
Codice.Text = Old
Codice.SelectionStart= pos - 1
End If
End Sub