Calling VB.NET method from C#

  • Thread starter Thread starter Vijay
  • Start date Start date
V

Vijay

Hi,

I do have the VB.NET method which has delegate as parameter.
I am calling this method from VB.NET project by using the commnad "Addressof( Function name which has same signature)".
How can i call the same method from C# Project?

Code Sample:

Delegate Definition on class inwhich VB.NET method is located.
Public Delegate Function fnRejectDelegate(ByVal dr As DataRow) As Boolean

VB.NET method definition.

Public Function GetFirstPage(ByVal pSize As Int16, ByVal delReject As fnRejectDelegate) As DataTable

Calling statement in VB.NET project

dtTemp = ctaTicketManager.GetFirstPage(5, AddressOf reject)

Function in VB.NET project with same delegate signature

Private Function reject(ByVal dr As DataRow) As Boolean

End Function

Since we don't have equivalent for "Addressof" operator in C#, how can we call the same method from C# project?

Thanks,

Vijay
 
bool reject(DataRow dr)
{
}

dtTemp = ctaTicketManager.GetFirstPage(5, new fnRejectDelegate(reject));



-- bruce (sqlwork.com)



Hi,

I do have the VB.NET method which has delegate as parameter.
I am calling this method from VB.NET project by using the commnad "Addressof( Function name which has same signature)".
How can i call the same method from C# Project?

Code Sample:

Delegate Definition on class inwhich VB.NET method is located.
Public Delegate Function fnRejectDelegate(ByVal dr As DataRow) As Boolean

VB.NET method definition.

Public Function GetFirstPage(ByVal pSize As Int16, ByVal delReject As fnRejectDelegate) As DataTable

Calling statement in VB.NET project

dtTemp = ctaTicketManager.GetFirstPage(5, AddressOf reject)

Function in VB.NET project with same delegate signature

Private Function reject(ByVal dr As DataRow) As Boolean

End Function

Since we don't have equivalent for "Addressof" operator in C#, how can we call the same method from C# project?

Thanks,

Vijay
 
Back
Top