How to pass UDTs to collections
VBBRWell, 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?
messixHi 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
VBBRThanks, 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.
SionVBBR, 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.
VBBRHum, 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 [:D])
SionArrr, tis true! I've been misquoting one of the greatest game classics for all time! Thanks for stopping me form humiliating myself. Here's a three-headed monkey for you http://members.tripod.com/~tommilin/monkey/3monkey.htm