Hi,
I want to use C# to register a call back function written in VB.net. I have the dll in VB.net that I am referencing in C#. what should I pass in the argument of RegisterCallback() function
Delegate
Sub DelegateSubscribeCallBack(ByVal publishedData As String)Private CallBack As DelegateSubscribeCallBack
Public Sub RegisterCallback(ByRef CallBackFunction As DelegateSubscribeCallBack)
If CallBack Is Nothing Then
CallBack = CallBackFunction
End If End Sub
Thanks,

Using C# to register to a call back function written in vb.net
Ammar Ismail
got it working...just added this
vbObject.DelegateSubscribeCallBack t =
new vbObject.DelegateSubscribeCallBack(MyCallbackMethod);vbObject.RegisterCallback(
ref t);magicalclick
class MyClass
{
public void SomeMethodThatDoesCallbackRegistration()
{
YourVBClass vbObject = new YourVBClass();
vbObject.RegisterCallback(ref new DelegateSubscribeCallBack(MyCallbackMethod));
}
private void MyCallbackMethod(string publishedData)
{
// your callback code here that will be invoked by the VB library
}
}
Venkata Prasad K
Thanks, but I got this error message on this line
vbObject.RegisterCallback(ref new DelegateSubscribeCallBack(MyCallbackMethod));
It did'nt like new in the line above
YourVBClass is a module....
Error MEssage : A ref or out argument must be an lvalue.