简体   繁体   中英

Calling VB.Net function from c#

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM