padvou Active Member Licensed User Longtime User Jun 2, 2015 #1 Hi. If I want an EditText to add a "-" after the first two digits, while the user enters numbers: for example: typed EditText shows 1 1 2 12 3 12-3 4 12-34 5 12-345 6 12-3456 Can this be done?
Hi. If I want an EditText to add a "-" after the first two digits, while the user enters numbers: for example: typed EditText shows 1 1 2 12 3 12-3 4 12-34 5 12-345 6 12-3456 Can this be done?
DonManfred Expert Licensed User Longtime User Jun 2, 2015 #2 padvou said: Can this be done? Click to expand... yes. Upvote 0
padvou Active Member Licensed User Longtime User Jun 2, 2015 #3 DonManfred said: yes. Click to expand... Thank you. I'll keep working on it. Upvote 0
fixit30 Active Member Licensed User Longtime User Jun 2, 2015 #4 You should look at the TextChanged event of EditText Upvote 0
padvou Active Member Licensed User Longtime User Jun 3, 2015 #5 Here's what I came up with: Code: Copy Sub EditText1_TextChanged (Old As String, New As String) If Old.Length<New.Length Then If Old.Length=2 Then New=Old.SubString2(0,2) & "-" EditText1.Text=New EditText1.SelectionStart=3 End If End If End Sub Upvote 0
Here's what I came up with: Code: Copy Sub EditText1_TextChanged (Old As String, New As String) If Old.Length<New.Length Then If Old.Length=2 Then New=Old.SubString2(0,2) & "-" EditText1.Text=New EditText1.SelectionStart=3 End If End If End Sub