Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enter percentages as whole numbers?
Message
From
26/01/2007 09:55:50
 
 
To
26/01/2007 09:51:42
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01189535
Message ID:
01189596
Views:
13
>>>>>>I have a data entry form containing percentage fields that are defined as N(4,2). I would like the users to be able to enter 100% as 100 rather than 1.00, 50% as 50 rather than 0.50, and so on. Is there some formatting option that supports this or is my only option to change the field definitions to N(3,0)? (They can never be greater than 100%).
>>>>>
>>>>>Mike,
>>>>>
>>>>>Check Enhanced Numeric Textbox Class File #9395
>>>>
>>>>Is it really needed to use new classes for so simple thing?
>>>
>>>It isn't needed, but I've recently been working with some code I inherited.
>>>
>>>I've come across at least 15 occurances of...
>>>
>>>local m.schName, I
>>>m.schName = ""
>>>for i = 1 to len(m.tcAcctNum)
>>> if substr(m.tcAccNum,m.i) = " "
>>> m.schName = m.schName + "?"
>>> else
>>> m.schName = m.schName + substr(m.tcAccNum,m.i)
>>> endif
>>>endfor i
>>>
>>>Now. Tell me exactly how long it takes you to decipher that and exactly what it does, and even better, how you would have done it differently please.
>>
>>It seems to be a ChrTran problem.
>>cSchname=chrtran(cAccnum,space(1),'?')
>>Anything else I don't quite understand, i.e. how it's related to this thread?
>
>Chrtran is a "component" of vfp. One might say it's almost a class. You were willing to reuse something to solve the problem. Why not reuse a numeric textbox instead of trying to remember what format/code, etc. to apply to the problem?

I don't think we have much to discuss here. Every rememberance is a complication for our poor brains, but every additional class is a complication too. One may create a class to produce 2x2=4, or any other similar operation, but then it's up to world to decide.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform