Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Blank when zero
Message
From
29/01/2009 23:37:45
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
29/01/2009 14:51:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01377989
Message ID:
01378363
Views:
24
>>transform(thisfField, "@Z 999,999,999")
>>
>>will return eleven spaces when thisfField is zero.
>
>Either I misunderstood Terry or he misunderstood the problem. His response (at least to me) indicated he was talking about formatting a field on a report (is there another place where "Print When" is used?).
>
>My problem is a textbox on a form. I would like to have it display Blank When Zero. Naomi's suggestion about the format property of the textbox was what I was using. It takes care of the problem......Until the textbox gains focus. At that point the zero appears. I was hoping for a solution where, when I enter the textbox and its value is zero, nothing appears until I actually start typing something.
>
>Does your Transform() code work in that situation?

No, transform() is a function which returns a string - so it's something you can use when you're using numbers in text, display, report, caption - anywhere where you have strings composed.

For a textbox with a numeric controlsource, tough - you may add K function code (so make it KZ or ZK), that should select whole text when it gets focus, so at least when the user starts typing the zero would go away. That's actually equivalent to setting .SelectOnEntry=.t. for the textbox. But you can't get rid of the zero unless you make your textbox contain a string, not a number - and then manipulate it by the rules for number entry, IOW reinventing the wheel for a pound of meat.

You may look around the download area, there are classes for numeric input. Maybe one of them is where that particular wheel has already been invented.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform