A Generic Variable
Ed Kleban
Ed at Kleban.com
Thu Dec 22 15:41:20 CST 2005
On 12/22/05 2:55 PM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:
> On 12/22/05 10:07 PM, "Chuck Pelto" <cbpelto at pcisys.net> wrote:
>
> Hi Chuck,
>
>> Is there any type of generic variable that I can use to hold either
>> numerical or character/string values from V4RB2?
>
> String/VarChar :-)
>
> Can keep both
If you are asking whether there is a generic variable type in RB, then the
answer is yes, this a the purpose of the type "Variant". A variable
declared of this type can hold anything thus the following are all valid
statements:
dim v as Variant
v = 23
v = "abcd"
v = 2.334
v = new Dictionary
If you are asking if there is a way to represent either a RB numeric or
string value in a single field type, then as Ruslan points out, you can
certainly convert the value to a string representation and store it in a V2
String or VarChar or Text field, depending upon it's size and various other
usage considerations. So if you wanted to store a string for an arbitrary
variant you could use:
aTable.recId = 23
aTable.aVarCharField.value = v.stringValue
...or...
aTable.aVarCharField.value = str(23.44)
That answer your question?
More information about the Valentina
mailing list