Retrieving non-string values

chuckbo chuckbo at hinkles.us
Wed Jan 14 15:48:43 CST 2004


Ruslan Zasukhin writes: 

> on 1/14/04 9:35 PM, chuck hinkle at chuckbo at hinkles.us wrote: 
> 
>>> You should use my_cursor.UShortField("VSize").value, which returns an
>>> integer.  Beware that calling one of these functions (like UShortField)
>>> on a field of the wrong type usually results in a crash, so you might
>>> consider adding an assertion before it that checks the type of
>>> my_cursor.Field("VSize"), at least for debug builds. 
>>> 
>>> Charles Yeomans 
>>> 
>>  
>> 
>> I still get the Type Mismatch error when I try to compile it.
>> I'm guessing that it's because I can't set an Integer variable equal to
>> the result of the UShortfield command; integers are 4 bytes and vushort
>> fields are 2 bytes. But what RB field type would be appropriate to use? Do
>> I need to move it into a Variant?
> 
> No, 
> 
>     dim k as Integer 
> 
>     k = 5 
> 
>     cursor.UshortField("f").value = k 
> 
> 
> Is quite legal. 
> 
> Chuck, I believe in V4RB examples present many places where is used .value
> Syntax. 
> 
> 

Yes, you're right, I've been doing that without any problems. My problem is 
going the other way, trying to set k = to cursor.ushortfield("f"). There's 
no .VALUE property for the cursor, and if I just use

    K = cursor.UshortField("f") 

then I get a type mismatch. Does it mean that I can't move a UShort field 
into an RB Integer variable? Do I have to go through the program and 
redimension this variable as vushort everywhere? 




More information about the Valentina mailing list