Situation:
a) I need to be able to control the entered value:
- Do not allow negative numbers
- Numbers greater than or equal to zero and less than 9,999,999.99
A colleague previously helped me to control only 2 decimals and negative numbers with this code which works ok:
I don't realize how I can "modify" it to NOT allow negative values and control the MAXIMUM allowed value.
Greetings!
a) I need to be able to control the entered value:
- Do not allow negative numbers
- Numbers greater than or equal to zero and less than 9,999,999.99
A colleague previously helped me to control only 2 decimals and negative numbers with this code which works ok:
B4X:
Private Sub edtImporte_TextChanged (Old As String, New As String)
'Nota: En el diseñador, configuro EditText1 para esperar una entrada DECIMAL.
'En los teclados numéricos, el signo menos requiere dos clics en mi dispositivo Samsung
If New = "-" Then edtImporte.TextColor = xui.Color_Red
Dim k As Int = New.IndexOf(".")
If k > -1 Then
If New.Length - k > 3 Then
Main.Beep.beep 'Hace un pitido
edtImporte.Text = Old
edtImporte.SelectionStart = Old.length
End If
End If
End Sub
I don't realize how I can "modify" it to NOT allow negative values and control the MAXIMUM allowed value.
Greetings!