Fire Event from a C# library into a VB Winform program : <p>I am a C# programmer and have made a C# library for handling a tcp/ip chat.
Now I have the necessity to use it from a Server VB Winform program.
I am pretty sure that this is an easy solution problem but I have been struggling for days.
So in the C# I have that class:</p>

<pre><code>public class AsynchronousServer
{
    public AsynchronousServer()
    {
    }

    public delegate void ChangedEventHandler(string strMessage);
    public static event ChangedEventHandler OnNotification;
    public static event ChangedEventHandler OnAnswerReceived;
    ...
}
</code></pre>

<p>Now I have to focus on the server program:
if that VB program would have been in C# I would have written the code below for connecting the server on a button click</p>

<pre><code>public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void btnStart_Click(object sender, RoutedEventArgs e)
    {
        AsynchronousServer.OnNotification += AsynchronousServer_OnNotification;
        AsynchronousServer.OnAnswerReceived += AsynchronousServer_OnAnswerReceived;
        AsynchronousServer.StartServer(tbxIpAddress.Text,tbxPort.Text);
    }
</code></pre>

<p>The same program in VB:</p>

<pre><code>Imports SocketLibrary

    Public Class Form1
    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
        AsynchronousServer.OnNotification                       &lt;--- member not present
        AsynchronousServer.OnAnswerReceived                     &lt;--- member not present
        AsynchronousServer.StartServer(tbxIpAddress.Text, tbxPort.Text);&lt;-----OK
    End Sub
End Class
</code></pre>

<p>the problem is that the member AsynchronousServer.OnNotification is not present at all so I can't add the event.
I am aware that I might have to add the WithEvents keyword but try as I might I couldn't succed.</p>

<p>In short I have to connect that VB winform program to a C# library event which I can't see from my VB class.</p>

<p>Thanks for any help</p>

<p>Patrick</p>
