ASP.NET NameSpaces

J

Joseph Cooper

I have created a few classes in a namespae for example Namespace
PageClassVB. However when I open up a Web page and type 'Imports
PageClassVB' the IDE shows an error as "Namespace or type
'PageClassVB' for the imports 'PageClassVB' cannnot be found". What
are the methods to refer to a namespace in another page?
 
G

Gary Vidal

You must add a reference to the assembly in your project prior to using an
imports statement.
 
K

Kevin Spencer

In addition, there is a difference in the way that NameSpaces are handled in
an assembly, depending upon what language you use to develop. In VB.Net, the
assembly name becomes the top-level NameSpace for the assembly, while in C#,
you define the NameSpace for the assembly in the code. So, if you put a
NameSpace into a VB.Net assembly, you're actually using a NameSpace that
resides UNDER the top-level NameSpace for that assembly.

If it gets confusing, and you're using Visual Studio.Net, you can use the
Class View to see the hierarchy of NameSpaces in your assemblies.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
K

Kevin Spencer

Let me append something to my remarks. I should have said that in VB.Net,
the DEFAULT NameSpace is the assembly name. You can change it in the Project
Properties dialog box, so that it is whatever you want it to be.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

Joseph Cooper

Hi Kevin,

Thanks for the reply. Could you let me know how to create the assembly
(The class file is part of the same project) and how do I add a
reference to the assembly to the project.

Thanks
Joseph Cooper
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top