Namespace question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M O J O

    Namespace question

    Hi,

    I've setup my project with this namespace "MyApp.Data ".

    I have about 40 classes in this project.

    Now I create a new class with this code....

    Namespace MyApp
    Namespace Settings
    Public Class Database
    ' bla. bla. bla.
    End Class
    End Namespace
    End Namespace

    Now suddently other projects can only see classes in the "MyApp.Settings "
    namespace.

    Where did all the other classes go to?

    How com setting namespace in one class messes up the namespace for the
    entire project?

    Do I really need to set up namespace "MyApp.Data " in all 40 classes?

    Thanks!!

    M O J O


  • Kevin Yu [MSFT]

    #2
    RE: Namespace question

    Hi MOJO,

    First of all, I would like to confirm my understanding of your issue. From
    your description, I understand that you cannot get classes in the
    MyApp.Data namespace after you have defined MyApp.Setting namespace. If
    there is any misunderstandin g, please feel free to let me know.

    As far as I know, namespaces are independent to each other. When you define
    your class in one namespace, the class will be NamespaceName.C lassName. If
    you need to avoid inputting the namespace name, you can use Imports
    NamespaceName at the place code begins. Will you try Imports MyApp.Data
    before your code?

    HTH.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    Comment

    • Nick Malik

      #3
      Re: Namespace question

      Hi Mojo,

      Not being a VB developer myself, is there some reason that you don't just
      declare your namespace with a dotted notation?

      Imports MyApp.Data
      Namespace MyApp.Settings
      Public Class Database....
      End Class
      End Namespace

      There should not be any effect at all on the other classes, BTW. In fact,
      the code in the other classes shouldn't "see" the code in the
      MyApp.Settings. Database (as far as intellisense is concerned) until you
      declare "Imports MyApp.Settings" in the other classes.

      Of course, if you have a "Database" class in both namespaces, you could be
      confusing yourself... Is that what's going on here?

      --- Nick

      "M O J O" <mojo@_no_spam_ delete_this_new websolutions.dk > wrote in message
      news:OmGHPTXlEH A.1356@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Hi,
      >
      > I've setup my project with this namespace "MyApp.Data ".
      >
      > I have about 40 classes in this project.
      >
      > Now I create a new class with this code....
      >
      > Namespace MyApp
      > Namespace Settings
      > Public Class Database
      > ' bla. bla. bla.
      > End Class
      > End Namespace
      > End Namespace
      >
      > Now suddently other projects can only see classes in the "MyApp.Settings "
      > namespace.
      >
      > Where did all the other classes go to?
      >
      > How com setting namespace in one class messes up the namespace for the
      > entire project?
      >
      > Do I really need to set up namespace "MyApp.Data " in all 40 classes?
      >
      > Thanks!!
      >
      > M O J O
      >
      >[/color]


      Comment

      Working...