Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert number to string and back
Message
 
 
To
31/03/2008 14:55:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01306961
Message ID:
01307151
Views:
14
>>Me too :) But I think my question was a valid one.
>>
>>In other words, if your numbers use scientific notation, do you want to preserve it for saving and restoring as well?
>
>This is the whole story:
>
>I already had a class for saving and restoring data to the registry. Now I'am doing this Form to set up parameters for a ZEBRA label printer, like left margin, top margin, darkness, print speed, printer name, etc.
>
>So I just dropped my registry class in the form and started coding. After a while, I realized that my registry class is "registry oriented" that is, you had to specify how to store a value in the registry in "registry terms" like REG_SZ, REG_BINARY and so on.
>
>I decided to change the registry class and do it more VFP oriented, that is, store NUMERIC, DATE, DATETIME, CHARACTER, LOGICAL and VARBINARY values, without worrying about the registry format, so that is what I did, now I just do:
>
>oRegistry.SetValue(cValueName, eValue)
>
>oRegistry.GetValue(cValueName, eDefaultValue)
>
>And that's it, the class takes care of everything, no more worrying about REG_SZ, REG_DWORD, etc. Also the registry key defaults to HKCU\Software\Exename, no need to worry about that either.
>
>Since the numeric values I plan to use are things like LEFT MARGIN, TOP MARGIN, PRINT SPEED, NUMBER OF COPIES, etc, I think .999999999999999 to 999999999999999 pretty much covers my range.
>
>I don´t think I will need to store bigger numbers in the registry, now or in the future, so I don´t need scientific notation capability for now.
>
>Since I will be releasing this shortly as part of the ctl32 classes, if anyone has other requirements, the source code will be available for anyone to change.
>
>Carlos

I see, thanks. I was considering your question more from the theoretical point of view rather than practical application.

Best of luck!
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform