Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to show + or - with numeric textbox?
Message
 
To
24/02/2000 15:29:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00336230
Message ID:
00337438
Views:
39
Excellent work!

Joe

>>>>Hi Al,
>>>>
>>>>Since it's read-only, would something like this do the trick for you?
>>>>
>>>>*in textbox.refresh:
>>>>This.InputMask = iif(This.Value > 0, '+999999', '999999')
>>>>
>>>>>A numeric textbox will always show a - (minus sign) before a negative number. However, I would like to explicitly show a + (plus sign) when the number is positive, and neither when it is zero.
>>>>>
>>>>>I couldn't find an InputMask or Format property that would do this. Am I missing something? BTW VFP 5.0a.
>>>>>
>>>>>TIA.
>>>
>>>Brilliant - works great. The only tiny quibble is that the "+" sign appears in a fixed position to the left of the number (as opposed to the "-" sign which is always right up against the number, regardless of width).
>>>
>>>But for sure, it's close enough for the girls I wish I went with.
>>>
>>>Thanks.
>>
>>
>>Re: quibble
>>
>>You can make it a little more sophisticated with a case statement or a bunch of embedded IIF statements. Basically, if the value is positive, then: If the value is less than 10, use "+9"; less than 100, use "+99"; etc..
>>
>>This should stick the sign up against the number.
>>
>>Take care,
>>Joe
>
>Something like:
>FUNCTION PlusSignInputMask
>
>LPARAMETERS ;
>	tnValue, ;
>	tnDecimals
>
>RETURN ;
>	IIF(tnValue > 0, "+", "") + ;
>	REPLICATE("9", LEN(LTRIM(STR(tnValue)))) + ;
>	"." + REPLICATE("9", tnDecimals)
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Previous
Reply
Map
View

Click here to load this message in the networking platform