problem with events between C# and VB projects...

  • Thread starter Thread starter lloyd
  • Start date Start date
L

lloyd

I'm writing a client/server application but have run into a very strange
behavior since I started mixing C# and VB.net.

On the client end there are 4 projects.
1. Common.dll, written in VB, which contains the network protocol to be
shared between the client and the server.
2. Client.dll, written in C#, which contains the client side network code
and events to connect to the server.
3. ClientA.exe, a client in vb
4. ClientB.exe, a client in C#

What is supposed to happen is when I receive a message from the server,
Client.dll fires an event with the message (type BaseMessage), defined in
Common.dll

in ClientA it refuses to build with the following error:
Method 'Public Sub OnMessage(baseMessage As
Common.ClientNetwork.Parameters.BaseMessage)' does not have the same
signature as delegate 'Delegate Sub ReceivedMessageEventHandler(baseMessage
As BaseMessage)'.

but in ClientB it works just fine.

code in clienta for adding the event handler is:
AddHandler Client.Network.NetworkEvents.ReceivedMessage, New
Client.Network.NetworkEvents.ReceivedMessageEventHandler(AddressOf
OnMessage)

Sub OnMessage(ByVal baseMessage As
Common.ClientNetwork.Parameters.BaseMessage)

while in clientb it is:

Client.Network.NetworkEvents.ReceivedMessage += new
Client.Network.NetworkEvents.ReceivedMessageEventHandler(NetworkEvents_ReceivedMessage);

public void
NetworkEvents_ReceivedMessage(Common.ClientNetwork.Parameters.BaseMessage
baseMessage)

I've tried various combinations of imports and function declarations but it
doesnt seem to make any difference, i'm pretty lost right now. Hopefully I
included all the pertinent information. anyone have any ideas? thank you.

Lloyd
SLOW30
 
Back
Top