Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a function written in VB from C# application

Tags:

c#

vb.net

I have a function written in vb

Public Function abc (ByVal x as Integer, ByVal y as String) As String 

End Function

I want to call this function on click of a button in C# applcation.

like image 535
CuriousMind Avatar asked Dec 30 '25 11:12

CuriousMind


1 Answers

If your VB function is inside a module, you need to call it by specifying the module name.

string result = MyVbModule.abc(1, "Hello");

You may also need to specify the namespace, wich per default is the name of the VB project:

string result = MyDll.MyVbModule.abc(1, "Hello");
like image 62
awe Avatar answered Jan 01 '26 03:01

awe