开发者

Calling VB.Net function from c#

开发者 https://www.devze.com 2023-03-21 08:56 出处:网络
I\'ve a vb.net class library and my c# application is accessing that method.My C# code gives me compile time error that \'Start\' is not supported by language, where Start is my method name.

I've a vb.net class library and my c# application is accessing that method. My C# code gives me compile time error that 'Start' is not supported by language, where Start is my method name.

Signature of Start method is

Public Sub Start(Byval frm as Form,
                 ByVal db as DBAccess,
      开发者_高级运维           ByVal roleID as integer)

where DBAccess is a userDefined class

and my c# calling code is

obj.Start(frm, db, roleID);

Thanks


According to this, this error can be caused by optional parameters in VB.net declaration or not-supported types in C#.
May be you should just recompile your vb.net library and re-add reference to your c# project.
But I think you should change your method definition to such:

Public Sub Start(Byval frm as Form, ByVal db as DBAccess, ByVal roleID as Int32)

type of roleID is changed from Integer to Int32.

0

精彩评论

暂无评论...
验证码 换一张
取 消