I got it solved. It appears that in .NET 1.1 you need to create an
array of objects. So instead of:
dm.vbDelegate.DynamicInvoke("this is a message.. ");
It should be like this:
dm.vbDelegate.DynamicInvoke(new object[] {"this is a message.. "} );
Benj Nunez isinulat:
> Hello everyone,
>
>
> I'm in the process of using delegates in a vb.net project which
> interacts with C# *.DLLs.
>
> The goal is to access the Listbox in VB *through* a delegate
> accessible by C#.
>
>
> 1) I declared a delegate like this in vb:
>
>
> Public Delegate Sub UpdateCommandHistoryDelegate(ByVal AMsg As String)
>
>
> 2) Then I use the code below to assign it to a delegate instance:
>
>
> Public Overloads Sub UpdateCommandHistory(ByVal AMsg As String)
>
> tabBase.SelectedIndex = 0 ' display the message(s) in the
> lstCommandHistory tab
>
> lstCommandHistory.Items.Insert(lstCommandHistory.Items.Count,
> AMsg) ' insert the status message
> lstCommandHistory.SetSelected(lstCommandHistory.Items.Count - 1,
> True) ' display the latest message
> End Sub
>
>
> 3) I pass the delegate to a C# method that accepts it. When I use it
> like this:
>
> dm.vbDelegate.DynamicInvoke("this is a message.. ");
>
>
> I get an compiler error: "Argument '1': cannot convert from 'string'
> to 'object[]'".
> Now how come the parameter is of type "object[]" when I am expecting
> it to be of type
> string?
>
> I'm using vs 2003 sp1, with .NET 1.1 framework.
>
>
> Thank you in advance for helping me out with this.