Assign Object to Variant and then Variant to Object 
Author Message
 Assign Object to Variant and then Variant to Object

Hello,

Do you know the syntax of assigning an object variable to a variant
variable and assigning a variant variable to an object variable?
Should set be used!?

Regards,

Poon Chak Yau,



Fri, 23 Feb 2001 03:00:00 GMT  
 Assign Object to Variant and then Variant to Object
To assign an object to a variable:
Set YourVariant = Object

To assign a variant to an object:
As long as the variant contains an object you can write
Set Object=YourVariant

If you write this
Object = YourVariant
VB will try to assign the variant to the Objects default property .

For Example:
Text1 is an object
Text is Text1 default property

dim aTextBox as TextBox
.
.
.
aTextBox = YourVariant
is the same as
aTextBox.Text=YourVariant

ok?

Alejandro Lapeyre


Quote:
>Hello,

>Do you know the syntax of assigning an object variable to a variant
>variable and assigning a variant variable to an object variable?
>Should set be used!?

>Regards,

>Poon Chak Yau,



Fri, 23 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. assigning "object-or-value" Variants

2. Array to Variant and Variant to array problem

3. Variant Replaced By Object

4. How to convert variant to object

5. As Variant upgraded to As Object causing problem

6. Set object into variant

7. Problem passing a variant array out of VBasic object to ASP

8. Passing a variant to a methos in an ActiveX object

9. returning empty variant array from COM object?

10. Variants and Objects

11. Kludge: C# classes, Object types, and VBScript Variants

12. Type Mismatch returning variant array from COM object

 

 
Powered by phpBB® Forum Software