VBBR
Moderator
Brazil
617 Posts |
Posted - Jul 11 2004 : 7:00:33 PM
|
Well, the question is simple and I hope the answer is too.
How do I make a UDT a member of a collection? (VB6) If I try, it says "only UDT's defined in public object modules can be coerced to or from a variant or passed to late-bound functions".
But how the heck do I declare a UDT in a public object module? HOW do create a public object module? I've tried adding a class to the project but then it says it can't define the UDT because it's within a PRIVATE object module.
...so? |
Whatever. Who knows... |
|
messix
Squire
Australia
19 Posts |
Posted - Jul 11 2004 : 11:00:26 PM
|
Hi VBBR,
I gave up on trying to do this, but did find someone else that had this problem with a few answers (someone else might have a better solution, but the info here is pretty good):
http://beta.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20663485.html
|
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - Jul 12 2004 : 06:29:25 AM
|
Thanks, this might solve my problem. Now remembering... I *think* that if I create a class inside an ActiveX DLL project I could define its scope (private, public). But creating a DLL just for UDT's is a bit nasty in my opinion. I guess I'll search a bit more. |
Whatever. Who knows... |
|
|
Sion
Warrior
Denmark
138 Posts |
Posted - Jul 12 2004 : 07:05:41 AM
|
VBBR, I ran into that problem while making the network class for the DaBooda Turbo engine. I found out (from MSDN) that it's simply impossible to use custom data types in collections. That is one of the few things that collections can not contain. So you have to work around it somehow. How you can do that depends on the purpose of the data, but you could make a class instead of a data type and use that in your collection. You would also make your own collection class that can contain custom data types. Infomation on how to make your own collections can be found by searching on google. |
Visit my personal blog at www.AndersNissen.com! |
|
|
VBBR
Moderator
Brazil
617 Posts |
Posted - Jul 12 2004 : 07:21:46 AM
|
Hum, converting the UDT's to classes looks like a good idea... altough it would be easier if I was using VB.NET as it would be just a matter of changing the declaration to "class"... Because in VB6 I need one file for each class. Also speed is not an issue here because the program I'm using this is an editor--not a game.
I think I'm going to do this. The class approach may prove itself useful later, who knows? Thanks.
(about your sig--for what I remember from monkey island, and I was playing it yesterday, there's no "it's" in this line ) |
Whatever. Who knows... |
|
|
Sion
Warrior
Denmark
138 Posts |
|