1.

Solve : User defined type to object in VB6?

Answer»

OK, Let's look at my previous question a different way...

I have a method inside a class that creates a user DEFINED type from a dll and wants to pass that out as an Object type.  The function looks a little LIKE this:

Code: [Select]
PUBLIC Function BytesToRect(objName As String, obj() As BYTE) As Object
    Dim PropBag As PropertyBag
    Set PropBag = New PropertyBag
   
    Dim myObj As MyClass.MyType
    Set myObj = PropBag.ReadProperty(objName)
   
    BytesToRect = myObj
End Function


Obviously, this will fail SINCE myObj is of type MyClass.MyType.  Is there a way in VB6 to convert this to an Object type and pass it from the function?  I was thinking that CObj or DirectCast in .NET would do this but I haven't found anything similar in VB6.

Thoughts?



Discussion

No Comment Found