B4J Question how set number value in TextField?

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi everyone

how to set number value in TextField? like B4A.

thank in advance
 

Roberto P.

Well-Known Member
Licensed User
Longtime User
my question is not clear!

how do I set input type number?
 
Upvote 0

behnam_tr

Active Member
Licensed User
Longtime User
use this

B4X:
Sub txt_tell_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 >= 18 Then   ' 18 is the max length allowed you can change this :)
        text = text.SubString2(0,18)
        update = True
    End If
    
    If update Then
        txt_tell.Text = text
        txt_tell.SetSelection(text.Length,text.Length)
    End If
End Sub
 
Upvote 0
Top