Paul Michaels
Paul Michaels

Reputation: 16695

Project with mixed languages in .NET

I’m not sure if what I am trying to do is possible, but surprisingly VS2008 seems to let me copy a .cs file directly into my VB.NET project. I then thought that I may be able to use the class in this file directly from VB.NET. However, it doesn’t see it when I try to reference it in. Is what I'm trying to do possible, or is VS2008 simply treating the C# file as a resource file or something?

Upvotes: 2

Views: 234

Answers (3)

FabioThorin
FabioThorin

Reputation: 150

Maybe you want the c# code translated into vb, then be sure to have a look at http://converter.telerik.com/ there are many code converter but is the best I know.

Upvotes: 2

empi
empi

Reputation: 15881

You should reference CS project that contains your class written in C# from your VB project. This class should be public. After doing it, you will be able to use this class in your VB project.

Upvotes: 5

Matt
Matt

Reputation: 7160

You'll need to add a C# project to the solution, rather than just copying the source file. Just create a new project making sure you select it as a C# class library or similar and make sure you add it to the current solution and then copy the source file into that.

Upvotes: 4

Related Questions