Validate only integers were entered into a text field

Apologies up front because I know this is likely the most basic of questions, but I am picking up Xojo for the first time in 7 years (I had written one desktop app with RealBasic 2007) and have not seen an example of how to do this yet.

I have a handful of textField entries in my desktop app that represent preferences for the use and need to be numeric. Looking for what the “best” way is to ensure the text entered by the user contains numbers only. I don’t care about the formatting of the numbers, just that there are only integers entered into the field.


Go to the “Mask” property of a textField (on the Inspector) and type in a bunch of number signs (e.g. “######”). Each represents a digit to be typed and won’t allow letters to be typed (it will just beep).

You can read more about the mask property in the Language Reference for more options (there’s a lot that can be done, allowing for decimal entry, etc.)

Wow. Thanks Marc. Don’t know how I missed that. I was struggling with the difference between Mask and Format and now that I actually read through the Language Reference on both it makes total sense. Go figure.

Thanks for the speedy response!

I like it when there’s a question I actually know how to answer. :slight_smile: