How do I add a class

D

David McCallum

First excuse my ignorance, but I'm completely new to VS2005 development

I've created a new project and want to add an already written class stored
elsewhere on the computer to the project.

This class will be used by a number of projects.

The problem is, if I right-click on the Project File in the Solution
Explorer and add the class a copy of the class is placed in the projects
folder. Any changes to the original class do seem to be followed through.

If I Add it to the Solution, any changes are followed through here, but I
cannot see how to reference the class in my form.

Can anyone point me in the right direction

TIA

David McCallum
 
C

Cor Ligthert [MVP]

David,

Have a look at the reference tabs in your IDE, they are in project and in
the solution explorere under the right mouseclick.

It depends very much if the class is a build Class Libarary or just added
code to your project, but basicely is it the answer above.

Cor
 
D

David McCallum

Cor,

I looked there, but cannot find my class. The only likely tab I see as
usable is the Browse tab, but it does not allow me to open a ".cs" file.

Do I need to do something to the file first?

David
 
C

Cor Ligthert [MVP]

David,

If it is a cs file than you can just use it in your project or use it in a
Class libary project that you add to your project. In that case you need the
project tab from the references.

Cor
 
C

Chris Dunaway

David said:
I've created a new project and want to add an already written class stored
elsewhere on the computer to the project.

Is the class part of another project? If it is a ClassLibrary project,
you can add that project to your Solution and then reference it on the
Projects tab.
This class will be used by a number of projects.

The best method would be to create a ClassLibrary project, add that
class to the project and then add that project to any Solution that
needs to use it. Any changes you make in one Solution will be
reflected in any other Solution that uses that ClassLibrary.
 

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