Click to See Complete Forum and Search --> : How to use someone elses classes in visual studio?


RickyWh
December 19th, 2008, 04:04 PM
Hi, I'm using visual studio 2008 and I recently downloaded a class example from a third party website. The example contains one directory and inside this directory are about 5 classes. This directory also contains a few other subdirectories that also contain .cs files.

I fired up a new project in visual studio 2008 and I dragged the folder into my project and all the directories and files show up fine now in solution explorer.

My question is that after looking at some of the files, I notice they are all using this namespace

namespace JeremyB.custom
{
...
}


So how do I go about loading up and instantiating some of these classes so I can work with the objects? I know how to do this normally when the classes are all in one file.

Object myIdentifier = new Object();

or if you want to use overloads you can check the calss definition files to see if there are any other ways to fire it up.

Do I need to add a using statement to my Program.cs in order to use these?

I tried typing JeremyB.custom. but intellisense is no help so I must be missing a using directive?


any help much appreciated,

Ricky,

RickyWh
December 19th, 2008, 04:05 PM
I must have been doing something wrong the first it seems intellisense is now working fine. However If I didn't want to continually type the namespace what would my using directive look like?

Ricky,

TheCPUWizard
December 19th, 2008, 04:06 PM
Either type the fully qualified name: JeremyB.custom.ClassName or make use of the using statement "using JeremyB.custom;"

btw: This is NO different than how you access collections (which are in a namespace), windows form controls (which are in a different namespace), Data (which is in yet another namespace)......

RickyWh
December 19th, 2008, 04:18 PM
Sweet, thanks for help.

using JeremyB.custom;

Works like a charm :D