Every time the text changes, run a loop to check to see if each text character is a number. If not, remove the non-number:
Edit: I didn't see Ramones's post when I replied. His method is very similar, but only stops the user from adding a non-number to the right-most character in the textbox. My capx will check every character (so the player can't add text in the middle of a bunch of numbers already entered).