Results 1 to 5 of 5

Thread: problem to get a type for a class defined in ClassLibrary

  1. #1

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Question problem to get a type for a class defined in ClassLibrary

    I created a ClassLibrary. But when I want to get the type of a class defined in that ClassLibrary it is = nothing. When I do the same inside of the ClassLibrary it gives me the type correctly :

    Dim myType as Type
    myType = Type.GetType("Library.Localisation.Country")

    (My ClassLibrary is called "Library" and the Class Country is in the namespace "Localisation").


    Thank you very much for any help about this !

    Regardes,
    Fabian

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: problem to get a type for a class defined in ClassLibrary

    what happens if you do
    Dim x as New Library.Localisation.Country
    messagebox x.gettype.tostring

  3. #3

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Re: problem to get a type for a class defined in ClassLibrary

    Hallo kleinma,

    thank you for your help!
    What you propose works fine.
    The thing is that I would always have to create an instance of a class to use the type. It would be much nicer to just access the type without creating an instance. Why this is possible in the way I have shown in the classLibrary and not outside? Is there any other way to go without creating an instance first?

    Anyway - thank you very much for your help!

    Regards,
    Fabian
    Last edited by fabianus; Sep 28th, 2005 at 03:54 PM.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: problem to get a type for a class defined in ClassLibrary

    you could create a shared function in your class that returns the type, then you would be able to get the type without creating an instance.

  5. #5

    Thread Starter
    Hyperactive Member fabianus's Avatar
    Join Date
    Sep 2004
    Location
    Paris
    Posts
    402

    Resolved Re: problem to get a type for a class defined in ClassLibrary

    ok!
    Thank you for your advices.

    Regards,
    Fabian

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