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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with the obvious

Status
Not open for further replies.

obliviux

Programmer
Jun 2, 2000
38
US
I have a text box that I am using to enter a dollar amount.<br>I have the <br>InputMask set to 999999.99<br>Format set to K$<br>control source m.amount_debt<br><br>The problem is that you have you use up the first 6 decimals before you can enter a penny amount. I want to be able to enter 55.54 instead of 000055.54.<br><br>What am I overlooking.<br><br><br>Thanks<br><br><br>Jeremy
 
Frustrating, I know.&nbsp;&nbsp;What I tell users:<br><br>type in 5 5 (period) 5 4 <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Yes that works everytime.&nbsp;&nbsp;In addition you can set <b><i>selectOnEntry = .T.</b></i> that will highlight the whole cell... it seems to relieve some confusion with my people too. <p> Pete<br><a href=mailto:blindpete@mail.com>blindpete@mail.com</a><br><a href= > </a><br>What your mother told you is true! You will go blind! (from moonshine anyway)
 
Jeremy<br><br>Try the following, assuming your .ControlSource can be a field in a table<br><br>In THISFORM.TextBox.When event put:-<br>THIS.InputMask = [999999999]<br><br>In THISFORM.TextBox.Valid event put:-<br>THIS.InputMask = []<br>REPLACE TABLE.amountdebt WITH TABLE.amountdebt /100 <br><br>Chris
 
Jeremy,<br><br>Apologies<br><br>I had pulled the preceding reply from an application using<br>.ControlSource as a field, and couldn't remember the code for use with a variable.<br><br>In THISFORM.TextBox.Valid event put:-<br>THIS.InputMask = []<br>m.amountdebt = m.amountdebt /100 <br>THIS.InputMask = [999999.99]<br><br>This will correctly format THISFORM.TextBox for the variable version.<br><br>The user simply enters the value as an integer and the code does the rest.<br><br>Chris
 
Hi, may be this is too late. You can type in the 0.00 at the value for the text box properties.
 
syangloo

Your idea certainly works but leaves a large gap between the first number and the decimal point, the gap closing up as you enter more numbers and disappearing when you key in the decimal point.

Apart from being unsightly, this gap might confuse inexperienced users.

You can offer users a choice, selectable by Checkbox for the whole form, of automatic decimal point insertion, as per either of the two earlier posts of Aug 10, or FoxDev's solution, which is direct and unambiguous.

The automatic decimal point insertion code was developed to speed up data entry.

In THISFORM.TextBox.When event put:-
IF THISFORM.chkAutoDecimal.Value = 1
[tab]THIS.InputMask = [999999999]
ENDIF

In THISFORM.TextBox.Valid event put:-
IF THISFORM.chkAutoDecimal.Value = 1
[tab]THIS.InputMask = []
[tab]REPLACE TABLE.amountdebt WITH TABLE.amountdebt /100
ENDIF

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top