Runtime error when trying to wire up multiple com events.

  • Thread starter Thread starter Vike_Fan_Forever
  • Start date Start date
V

Vike_Fan_Forever

I am having a problem that looks exactly the same as the below link.

http://www.google.com/groups?hl=en&...=&selm=FBThr67iCHA.1884%40cpmsftngxa06&rnum=7

I was wondering if any one has ran into this problem, and has any
reslolutions for it? I have tried all the suggestions from the above
post, and it has not fixed my problem.

Below is my source code, and if I comment out one of the two event
handlers, I no longer get the run time error. This only happens if I
try to wire in more than one event.

using System;
using System.Runtime.InteropServices;
using ANC12Com;

namespace Hunt.Transmitter.TSII.TableWriter
{
/// <summary>
/// Summary description for Foo.
/// </summary>
public class TableWriter
{
private ANC12Com.ANC12ComXClass ANC12 = new ANC12ComXClass();


public TableWriter()
{
RegisterHandlers();
}

public void RegisterHandlers()
{
//With either of the below lines commented out runtime is fine.
ANC12.OnLogon += new
IANC12ComXEvents_OnLogonEventHandler(Foo_OnLogon);
ANC12.OnLogoff += new
IANC12ComXEvents_OnLogoffEventHandler(Foo_OnLogoff);
}

#region Event Handlers

public static void Foo_OnLogon()
{

}
public static void Foo_OnLogoff()
{

}
#endregion Event Handlers
}
}

If any one has any suggestions I would appreciate it.

Thanks,

B.H.
 
Back
Top