Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add numeric string as property value?
Message
 
À
16/07/2009 15:36:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Divers
Thread ID:
01412603
Message ID:
01414139
Vues:
231
Not really sure what you need to do here, but if you have special format then the easiest thing to do is create a class property with a getter and setter and have a private field with the actual value and a string field with the formatted expression. The getter and setter then handle the parsing of the value automatically as values are set and got out of hte property. This way you are always dealing with strings and the designer should be able to handle the value properly.

+++ Rick ---

>As I said earlier to Naomi, I was hoping there was an Excel-like feature in VFP i.e. if you type a single quote character ' before entering a number, that instructs Excel to treat it as a string.
>
>But, that opens up another can of worms. The VFP property sheet shows strings without delimiters (e.g. quotes). For consistency, it would have to show all strings with delimiters:
>
>MyProp = "This is a string" -> appears as: This is a string
>MyProp = 1.00 -> appears as: 1.00
>MyProp = "1.00" -> appears as: ="1.00"
>
>The behaviour would need to change to:
>
>MyProp = "This is a string" -> appears as: "This is a string"
>MyProp = 1.00 -> appears as: 1.00
>MyProp = "1.00" -> appears as: "1.00"
>
>IMO the second set of behaviours is more consistent/elegant.
>
>>What's inelegant about MyProp = "1.00"? It does exactly what it says. It's a string...
>>
>>+++ Rick ---
>>
>>>>>Can someone refresh my memory:
>>>>>
>>>>>I have a class property, I want to put in "1.00" (i.e. a string) as its value. If I type in 1.00, it's set to be a numeric. How would I enter the string "1.00" in this case?
>>>>
>>>>
>>>>="1.00"
>>>>
>>>Thanks - that works, I (re-)discovered that about the same time Naomi pointed it out. As I remarked to Naomi, I was hoping for something a little more elegant.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform