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
.
精彩评论