Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entering numbers in a TextBox with format and inputmask
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00143964
Message ID:
00143978
Views:
29
>Has anyone found a way to enter numeric data into a textbox and have it display correctly as it is being typed? If I use an inputmask such as "999,999,999" and you do data entry of the number 45000, you will see 450,00 before you accept the entry and it reformats correctly to 45,000. I've tried many variations of using the format and inputmask properties but no success.

Jim, the radical solution is to do it on the framework level. As others say you can use some classes from the Files section, or for example, add to your base textbox class property cInputmask and the code below you will get what you want.
********************************
* textbox.Init()
	this.cInputMask = this.InputMask
* textbox.GotFocus()
	IF type("this.Value") $ "NFYBI"
		this.InputMask = STRTRAN(this.InputMask,",","")
		this.InputMask = STRTRAN(this.InputMask," ","")
	ENDIF

*textbox.LostFocus()
	IF type("this.Value") $ "NFYBI"
		this.InputMask = this.cInputMask
	ENDIF
************************************
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform