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 VB.net files? Also the class is a static class.
LVL 2
brgdotnetcontractorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0
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 VB.net modules?
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
sol1.pngsol2.png
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

brgdotnetcontractorAuthor Commented:
Hey Shaun,

My solution has several projects in it. How do I make the static class available to all projects?
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
Add a reference to all projects, Import into modules and use the public methods
0
brgdotnetcontractorAuthor Commented:
Typically when I add a reference, it is to a dll file? What at am I adding a reference to?
0
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 VB.net things are different. but referencing the class through add reference dialog, does not sound right to me?
0
Kyle AbrahamsSenior .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.
0
Peter HutchisonSenior 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
or
Namespace.ClassName myDLL = new MyNamespace.MyClassName();

Then you can call call methods from the other class.
myDLL.MyMethod();
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.