I Izzy New Member Apr 30, 2013 #1 Hello everyone, I was hoping someone might be able to help me with a problem I'm having. I've tried looking up the correct syntax I need for my situation, but haven't been able to do so. Basically, I've made a user form in Basic4Android. In this form I have an EditText for date and time. What I'm wondering is how can I format what the user puts into these text boxes? What I'd like to do is use this code txtdate.InputType = txtdate.INPUT_TYPE_NUMBERS to only allow the user to use the number keypad when entering in values in the text box, but how would I make the program throw in the /'s so it can be 11/11/11? And the same with the : in time? Thanks for reading, Iz
Hello everyone, I was hoping someone might be able to help me with a problem I'm having. I've tried looking up the correct syntax I need for my situation, but haven't been able to do so. Basically, I've made a user form in Basic4Android. In this form I have an EditText for date and time. What I'm wondering is how can I format what the user puts into these text boxes? What I'd like to do is use this code txtdate.InputType = txtdate.INPUT_TYPE_NUMBERS to only allow the user to use the number keypad when entering in values in the text box, but how would I make the program throw in the /'s so it can be 11/11/11? And the same with the : in time? Thanks for reading, Iz
walterf25 Expert Licensed User Longtime User Apr 30, 2013 #2 Date format inside edittext Hi there i've never tried this but this should be a start, let me know if it works! Code: Copy Sub EditText1_TextChanged (Old As String, New As String) If New.Contains(" ") Then edittext1.Text = New.Replace(" ", "/") edittext1.SelectionStart = New.Length End If End Sub it won't work if you set the edittext.typeinput to numbers only. Give it a try! Regards, Walter Upvote 0
Date format inside edittext Hi there i've never tried this but this should be a start, let me know if it works! Code: Copy Sub EditText1_TextChanged (Old As String, New As String) If New.Contains(" ") Then edittext1.Text = New.Replace(" ", "/") edittext1.SelectionStart = New.Length End If End Sub it won't work if you set the edittext.typeinput to numbers only. Give it a try! Regards, Walter