Problem adding UDT to Collection 
Author Message
 Problem adding UDT to Collection

I'm having trouble adding user defined typed variables to a
collection.  This seems like it should be simple enough.  When I try,
however, I get the error:

"Only user-defined types defined in public object modules can be
coerced to or from a variant or passed to late-bound functions"

Code to follow, thanks for any help!

    item As Integer
    item2 As Integer
    item3 As Integer
End Type

    Private b As Collection

Private Sub Form_Load()
    Dim a As testtype
    Dim count As Integer
    For count = 1 To 10
        a.item = 1
        a.item2 = 2
        a.item3 = 3
        b.Add a
    Next
End Sub

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem adding UDT to Collection

This seems to be an often-asked question.  Turns out that only UDTs declared
in publicly-creatable classes of an Ax component may be added to a
collection.  Switch to using classes.

--A



Wed, 18 Jun 1902 08:00:00 GMT  
 Problem adding UDT to Collection
Indeed!
Neila


Quote:

> This seems to be an often-asked question.  Turns out that only UDTs
declared
> in publicly-creatable classes of an Ax component may be added to a
> collection.  Switch to using classes.

> --A



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. type/collection/udt

2. Passing UDT to a collection

3. Sending a UDT OR Collections/Classes through Winsock

4. Passing UDT to collection headaches

5. Create collection of UDT

6. collections with UDT

7. Collection objs and UDT

8. storing UDT's in collection - can u ?

9. collection of udt

10. UDT and collection

11. Collection of UDT type variables

12. How to return UDT's in a collection from a function

 

 
Powered by phpBB® Forum Software