Android Question need help with textchanged

tufanv

Expert
Licensed User
Longtime User
Hello

For the last 2 hours i am trying to make something that looks easy but i cant do it.

I have a textbox. I want this when the user start typing ( it is a numbers pad ) whenever the new text is not empty it must add my country's money symbol TL at the end lets say user entered 2 , the textbox must show 2TL. At the same time i want to group the textbox with numberformat2(textbox.text,0,0,0,true)
so for example lets say user type 2450 it must be 2,450TL. but i got errors with each try. Can someone post a simple code example here if you know how to achieve this.

TY
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

try this :
B4X:
Sub edtUserName_TextChanged (Old As String, New As String)
    If Old = New Then
        Return
    End If
    If New.EqualsIgnoreCase("") Then
        Return
    End If
    Try
        edtUserName.Text = NumberFormat2(New.Replace("TL", "").Replace(",", ""), 0, 0, 0, True) & "TL"
        edtUserName.SelectionStart = edtUserName.Text.Length - 2
    Catch
        Log(LastException)
    End Try
End Sub
 
Upvote 0
Top