Namespace question

M

M O J O

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
 
K

Kevin Yu [MSFT]

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 misunderstanding, 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.ClassName. 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."
 
N

Nick Malik

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top