Results 1 to 25 of 25

Thread: [Resolved] Problems with a .dll Public Enum...

  1. #1

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Question [Resolved] Problems with a .dll Public Enum...

    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.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    If you make it public in one of your classes, it should be accessible by everything.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    You'd think so, wouldn't you?

    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?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    And the class is public, and MultiUse?

    Hmm...I'll have to think about that one...(And I'm not being sarcastic, neither!)
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    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.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  6. #6

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    The Class instancing is set to 5-MultiUse. I see where the private class setting can be effected. So yes, I guess it's a public class. (They all are).
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  7. #7
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Public , MultiUse, its all the same. Just so its not Private. I just needed a second condition to make my response look cool.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    That's the spirit!
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  9. #9

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    ?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  10. #10

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Perhaps the solution is in this picture...

    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...



    Attached Images Attached Images  
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  11. #11

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Ok that didn't help. That thing just comes up for any Enum in the classes....


    Come on ppl... need some help here...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  12. #12
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    Make the Enum public in a class.. and set its instancing property to GlobalMultiUse..

  13. #13

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Have given that a try, but I still get the 'Variable Uses an Automation Type not supported by Visual Basic' error...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  14. #14
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    Can u attach your project?

  15. #15
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try making the Enum in a seperate PublicNotCreatable class. Then use it in the two other classes for which you need it.

  16. #16

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Tried that too...

    Same problem...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  17. #17
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  18. #18

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I have attached the relevant project. Could you do me a favour and just try to compile it to a .dll, and tell me the results you get?

    (I think it's all in this zip...)

    Cheers,
    RJ
    Attached Files Attached Files
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  19. #19

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Your setup is fundamentally identical to mine.

    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...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  20. #20
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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....

  21. #21

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    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...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  22. #22
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I think I found it:

    Optional lngPictureID = Null

    The last item in the 'AddNewQuestion' question signature. It doesn't like you setting a variant to NULL change it to NOTHING and it compiles.

  23. #23

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Thanks matey!

    Saved me, I'd have never looked at that...


    That lack of error source was killing me...










    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?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  24. #24

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Worked. Cheers!

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  25. #25
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

    Glad it worked !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width