vb.net c# mix

J

John

Hi

Can I add classes written in c# to my vb.net project? If so how can I call
c# classes? Same as in vb.net?

Thanks

Regards
 
R

Robin Tucker

Hi John,

You can't mix the two in the same project but you can add projects that use
C# and VB.NET together in the same solution. If you have C# classes,
separate them into a library and then import the library into your VB.NET
project to use them.



Robin
 
J

John

Thanks. I have created a c# class library project with classes all belonging
to myns.utils.myutil namespace. I have added this c# project to the solution
that contains my vb.net project. How can I now use c# classes from within my
vb.net project?

Thanks

Regards
 
R

rowe_newsgroups

Thanks. I have created a c# class library project with classes all belonging
to myns.utils.myutil namespace. I have added this c# project to the solution
that contains my vb.net project. How can I now use c# classes from within my
vb.net project?

Thanks

Regards

Set the output type of the C# project to a dll (if not set already)
and then rebuild the entire solution. Then, in the VB project add a
reference to the C# project and use it like you would any other Dll
file.

Thanks,

Seth Rowe
 
H

Herfried K. Wagner [MVP]

Robin Tucker said:
You can't mix the two in the same project but you can add projects that
use C# and VB.NET together in the same solution.

Exception: ASP.NET projects.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top