Results 1 to 7 of 7

Thread: Namespaces? [RESOLVED...]

  1. #1

    Thread Starter
    Hyperactive Member anita2002's Avatar
    Join Date
    Dec 2001
    Location
    In u'r Heart
    Posts
    482

    Lightbulb Namespaces? [RESOLVED...]

    Thre are 3-4 modules (subprojects) in my application. Even their locations are also different. Now how can I access the classes defined into other module? I have given the same root namespace for all the modules. How to proceed now?
    Can anyone pls. explain me?
    Ani
    Last edited by anita2002; Dec 11th, 2003 at 08:35 PM.
    Can't imagine life without VB
    (Various Boyfriends)

  2. #2
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    Uh? As far as I know, the namespaces, or more simply put, the name of the class or module CAN'T be the same as another and the CAN'T start with a number.

  3. #3

    Thread Starter
    Hyperactive Member anita2002's Avatar
    Join Date
    Dec 2001
    Location
    In u'r Heart
    Posts
    482
    Originally posted by nkad
    Uh? As far as I know, the namespaces, or more simply put, the name of the class or module CAN'T be the same as another and the CAN'T start with a number.
    Class names are differnt. I have some modules (having different names) and different paths. But I have given the same rootnamespace name because I want to access classes from module in other module. So how this can be achieved?
    If I specify different namespaces then can I Import the other namespace and access its functionalities?Pls. explain.
    Can't imagine life without VB
    (Various Boyfriends)

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    If all your modules(which are just classes in .Net), are in the same project directory... you don't need to explicity declare a namespace...they inherit the namespace from your project.

    If they are in different places, you must right-click your Project you will be using them in... Add Reference... and with the .Net tab selected.. click Browse.. and select the dll from your compiled classes.

    Then use...
    VB Code:
    1. Imports YourNameSpace.YourClass
    in any class in your main project that needs to use those classes.

  5. #5
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    What do you mean 'rootnamespace'. Can you give me an example of your setup?

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    If you have 3 projects in a solution...

    And you want to use code from the project 2...

    You simply add a reference for Project 2 as I described above to Project 1. In any class you want to use the reference... use Imports Project2

  7. #7

    Thread Starter
    Hyperactive Member anita2002's Avatar
    Join Date
    Dec 2001
    Location
    In u'r Heart
    Posts
    482
    Thanks nemaroller & nkad. I got that now.
    BTW, 'rootnamespace' means the project namespace. U can find this in Project properties.
    Can't imagine life without VB
    (Various Boyfriends)

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