How to reference a VB .net class once I create it?

I created a VB .net class for my poject. The class was by default placed in a folder named "Solution Items". How do I reference this class in other files? Also the class is a static class.
Who is Participating?
Shaun VermaakConnect With a Mentor Technical Specialist/DeveloperCommented:
Shaun VermaakTechnical Specialist/DeveloperCommented:
It is easier if both projects are in the same solution. This way you can select Add Reference from Solution Explorer and browse to the other project from the project tab.
brgdotnetcontractorAuthor Commented:
They are in the same solution. Only a folder was created for the class named "Solution Items". They are indeed in the same solution.

How do  reference the class from other modules?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

brgdotnetcontractorAuthor Commented:
Hey Shaun,

My solution has several projects in it. How do I make the static class available to all projects?
Shaun VermaakTechnical Specialist/DeveloperCommented:
Add a reference to all projects, Import into modules and use the public methods
brgdotnetcontractorAuthor Commented:
Typically when I add a reference, it is to a dll file? What at am I adding a reference to?
brgdotnetcontractorAuthor Commented:
I don't get it? In C# you create a C# class and wrap it in a namespace. Then you can import the namespace.

I know that in things are different. but referencing the class through add reference dialog, does not sound right to me?
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
You can add a reference to a project if it's in the same solution.  That's true for both c# and .Net.  When you do that you add a dependency of one project to the other project.

The compiler will compile the dependent solution first, and then automatically add the DLLs to the parent project.

If you add a reference to a DLL you're just using the output code.  The difference there is if you update functionality in the DLL you have to update the DLL and (possibly) re-import it.
Peter HutchisonConnect With a Mentor Senior Network Systems SpecialistCommented:
Once you add the project file to your solution you can then add the following reference to your code:
E.g. VB
Dim myDLL as MyNamespace.MyClassName
Namespace.ClassName myDLL = new MyNamespace.MyClassName();

Then you can call call methods from the other class.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.