OK, have a public Enum in a .dll.
I want this Enum accessible by 2 separate classes.
But when I put it in a module as a public enum, the compiler won't let me use the Enum as a parameter type in one of those classes.
If I put it as Private in both classes, it won't be visible to external objects.
How to get around this problemo?
Last edited by rjlohan; Sep 3rd, 2002 at 07:21 PM.
I have tried that and get 'Variable Uses an Automation Type not supported by Visual Basic' error. And the fun part about this error is that the IDE doesn't highlight anything to indicate where the error is coming from...
And what about when an external object creates a class in the .dll which wants the Enum, but doesn't have it, as it is in another class which is not created?
It's MultiUse, yes. I'm not sure I understand how to make a class public though... ?
The .dll contains 3 classes, of which an ASP may create any 1 to serve their respective purposes at any time.
One class holds all info/funcs. for logging in to the program
One handles question retrieval, display, and validation
The 3rd one handles DB administration stuff.
I have broken them up in this way to limit overhead, as the 2nd one needs to be about for the life of an ASP session, whilst the others (esp. the 1st class) are created and destroyed on one ASP.
Your solution is actually accepted in the IDE when I do a run with full compile for testing. But when I try to compile to a .dll, it doesn't like me anymore.
This picture is a shot of the ObjectBrowser, whilst I am examining the ADODB library. Perhaps this is the solution? What are those things with the yellow icon (as opposed to the class module icon), and how do I make one?
They are all called XXXEnum, so this makes me think it's possibly what I want...
Seems like some VB wierdness then or its something else about it. It worked fine for me with just having the enum in one of the classes with instancing multiuse.
I have the enum in a totally separate class in the one I sent you, although I have tried it in one of the two classes which actually use it, all with the same result - this boscure error, with no apparent source...
What makes you say the Enum is causing the error? This is really wierd! I can run your project from a group in the IDE but it doesn't want to compile. I also only see 1 class that uses the enum so I moved it to that class but it still does the samething upon compile. Still checking....
I'm not saying that's necessarily causing the error, but this was compiling fine until I added the clsNRRDBAdmin class yesterday, which at the moment contains only 1 function, a parameter of which uses that enum.
That's all I changed, and now I get this error. Hence, I am guessing it has something to do with this enum, as that is really the common link, and certainly the only thing in the project that I'm not sure about.
That new class, and the function in it is simple as, there's nothing to it. And like you, I can run the project in a group in the IDE, but the ***** won't compile...
Now that it's solved, what do you reckon is the best design approach for that enum? In one of the classes that uses it, or a separate globalmultiuse class?
I guess the question of where is just a personal one, you could say since it works in the existing class then there is no need to put it in its own or since its shared you should put it seperate just in case later you move the class that has it out of the library and it breaks the other class it was sharing with without realizing it.