How do I add a class

  • Thread starter Thread starter David McCallum
  • Start date Start date
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
 
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
 
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
 
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
 
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.
 
Back
Top