Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decimal point in form

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi,

I have a form where a user enters an amount in a TEXTbox field. I want him to simply enter 9.95 (if it $9.95) but now he must enter 09.95. How do I have so that he doesn;t have to enter the 0 and so that when he presses the deciaml, it kinda "knows" that he pressed the deciaml so it "formats it properly

Maybe I'm missing something??? My brain is on 'vacation" mode. sorry.

any help needed please.


Thanks,
FOXUP!
 
If you bind the control to a numeric field you get this behavior for free (unless you've diddled with other stuff that conflicts).

What's your .ControlSource? .Format? .InputMask?

What else have you set?
 
.format = 99.99
.inputmask = 99.99

.controlsource is nothing because I just want the user to enter a value in that textbox.

please help.

thanks,
FOXUP!
 
Foxup,

Set the .Value property to 0 (the number zero, not a string "0"). Do that either in the control's Init or at design time. That will force it to be numeric, and you should then get the desired behaviour.

If you don't want the zero to appear when the control is empty, set its Format to Z (not to 99.99 as you are doing at present).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
doesn't work. what do i set the .input mask to ?
 
HMMM... works good now. weird. Thank you. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top