Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I call c# class from vb.net? 1

Status
Not open for further replies.

NearAway

Technical User
Feb 6, 2003
9
CA
hello,

I have imported a c# object into my vb.net probject, but I can't find a way to call the c# class.

I can call another vb module just fine however. There must be something significant I'm missing. I tried:

Imports classname, and
imports namespace.classname, and

calling the class directly from vb code:

classname.methodname

but nothing has worked and I'm stumped.

I did some searching and I didn't find an answer to this problem yet. Any ideas?

many thanks
 
Hi John, thanks for you input. I did try that, but the c# class isn't a dll, I have added it as a class module in my vb app. I can see and edit the c# class in the .net solution explorer, and it's got the c# icon next to it, just like how my vb modules have the vb icon next to them. Also, the project builds without errors.

The c# class is just like another module. I can see it but I can't call any of the methods of it. thanks
 
NearAway,

You can not mix vb.net and c# classes in the same project. You can divide your code into seperate projects. Create a vb project with its own dll and a c# project with its own dll. You will then need to create a reference in the vb to the c# project. This should allow you access to the c# code.

 
Thanks TWillard, that did it! you rock! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top