Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 How to pass UDTs to collections

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
VBBR 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?
5   L A T E S T    R E P L I E S    (Newest First)
Sion Posted - Jul 12 2004 : 07:34:12 AM
Arrr, 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
VBBR 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 )
Sion 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.
VBBR 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.
messix 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

VBGamer © Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.