Hello,
I am fairly new to Xojo and getting used to where everything is. I am building a windows program with a SQLite database. One thing I want to do is format the phone field so that the user can only enter digits. I goggled and read some topics about putting “(xxx) xxx\-xxxx”. When I enter that in the validation field, I have to enter a “(” the first time and then it doesn’t work. Also, when the record is called by pressing next, the phone number is not being displayed. Also, any way to use the enter as the tab?
Thanks in advance
Try putting this code in the Open event of the TextField
MyTextField.ValidationMask = "(###) ###-####"
Same thing, forcing me to enter “(” first, then I can enter all the digits
I’m sorry I misread your first post
TextField1.ValidationMask = "### ###-####"
Doing it that way worked but the parenthesis do not show up
ok well we are getting closer
Now that you have what the user entered and want to put parenthesis around the first three numbers
I will give you this Xojo link and study String.Left, String.Right and String.Trim
Strings
Hope that all helps and let us know if you need more help
Thank you Brian,
I think I got it. On the open event for the field I entered "TextField.Mask = “##########”. On the LostFocus I entered "TextField.Format= “(###)###-####” but when I saved the record, I had to put "TextField.Format= “” after I saved, otherwise it was not showing me number while browsing.
1 Like
Hi Guys,
Brian, what I did didn’t work as expected. I ended up doing what you said with the LEFT on lostfocus
1 Like