call procedure in vb.net form class from c# class?

hi all,

I don't code in c# and know little about it, but I have a library of code that I'm using.   Primarily I code in vb.net.   I have added error handling within many of the functions and procedures of the c# library classes.   I would like to call a procedure that is in my vb.net form from within my c# code.   Can someone please show me how I can do this?   The procedure is just a one liner name, no parameters to pass or anything.   also, the vb.net form is already open.

regards
LVL 1
OnlineNoobAsked:
Who is Participating?
 
etmendzCommented:
So the VB.Net project is a Windows application. Is the C# project also a Widnows application? Or is the C# project .dll?

Anyways, please remember that an .EXE application has an application domain which makes its bounderies clear: its members are for itself. That means, it is impossible to let a C# project access the members of a VB.Net application project. But you can let the VB.Net application project access the members of the C# project.

What you can do is to create a VB.Net .dll that defines the member you wanted to share to other projects. You can then use this .dll in both your VB.Net app and your C# .dll.

Have fun.
0
 
Fahad MukhtarDistinguished EngineerCommented:
if you meant to say that you have a class library written in C# then you can easily use that DLL in your VB.NET Code. Just click *Project-> Add Reference* menu and browse for the C# DLL.  Then you can easily use the classes in that DLL by using either

using MYCSHARPDLL;
.................
myCSharpClass c  = new myCSharpClass();
c.myCsharpFunction();


or without *using* keyword

MYCSHARPDLL.myCSharpClass c  = new MYCSHARPDLL.myCSharpClass();
c.myCsharpFunction();

0
 
OnlineNoobAuthor Commented:
I have sevearl C# classes uncompiled in my solution, along with my vb.net project.   I would like to call public procedure in the vb.net form class from within my c# class.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
sukumar_diyaCommented:
Hi,
Check this url http://www.codeproject.com/csharp/GBVB.asp
It helps to convert vb.net code to c#.

Cheers
Sukumar
0
 
Fahad MukhtarDistinguished EngineerCommented:
you can put your C# code in a dll and then acces in vb.net application easily...
I dont think you can use both C# classes in vb.net it in the same application
0
 
Fahad MukhtarDistinguished EngineerCommented:
It would be possible in the upcoming version of VS.Net
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.