Amit Kumar Jha Amit Kumar Jha - 1 year ago 103 Question

Use VB.NET and C# in the same application?

I am developing a GUI based application in MS Visual Studio 2005, I just want to
know if it is possible to use both VB.NET and C# in the same project. Or can I include a module written in C# in my VB.NET project?

I have a class written in C# which I want to use in my VB.NET based project, so if I can include and call functions from that project than I won't have to write the class again in VB.NET.

So please help me as I am new to .NET programming.

Answer Source

I've never done it myself, but I know you can compile the C# code into a dll and then load and reference the dll in your VB project.

From "Calling C# class in":

I think the C# code that you want to use must be compiled as a DLL. Once that is done, simple add a reference to that project to your VB.Net project, import the namespace you need, and then you can use the C# code.

Also see How To: Create and Use C# DLLs (from MSDN, for VS2005)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download