common custom classes

T

Tony

I have created a few pages in asp.net with in line code and have decided
to convert them to use code behind pages. I have some classes that are
common to more than one page. How do I add a namespace to my code behind,
so I can have one file with my code behind that includes a reference to a
file with my common classes in it?

Thanks

Tony
 
J

John M Deal

If the file containing the common classes is in the same project but has
a different namespace you can simply put a using (C#) or Imports(VB.Net)
statement at the top of the code behind class:

using The.Other.Namespace; //This is for C#

or

Imports The.Other.Namespace 'This is for VB.Net

If the file containing the other classes is in another project/assembly,
you'll also need to set a reference to the DLL that contains the class.
Hope that helps.

Have A Better One!

John M Deal, MCP
Necessity Software
 
T

Tony

If the file containing the common classes is in the same project but has a
different namespace you can simply put a using (C#) or Imports(VB.Net)
statement at the top of the code behind class:

using The.Other.Namespace; //This is for C#

or

Imports The.Other.Namespace 'This is for VB.Net

If the file containing the other classes is in another project/assembly,
you'll also need to set a reference to the DLL that contains the class.
Hope that helps.

Thanks for the reply, I am programming in VB.net using a text editor, do I
absolutely need to compile my common classes into a dll or is there a way
of adding a reference/path to a source file? if so what is the syntax?

Tony
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top