Accessing a COM Component

B

Bradley Grant

I been trying to write a program to access a COM Component
for a while now, with out much success so far. The
following is part of the code of my program, and this is
the message I get, can anyone see at a glance what I might
be missing.

Any advice would be appreciated.

Method 'USB.Form1.button5_Click(object, System.EventArgs)'
does not match delegate 'void
BDaq._IBBDaqEnumEvents_OnChangeEventHandler()'

namespace USB
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
//Declare an object variable to hold the device collection.
public BDaq.BBDaqEnum Connected;
//Declare an object variable to hold a device.
public BDaq.BBDaqDevice Device1;

//public BDaq.BBDaqDevice Device2; // for a second module

//More code

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

Connected += new
BDaq._IBBDaqEnumEvents_OnChangeEventHandler(this.button5_Click);
//
// TODO: Add any constructor code after
InitializeComponent call
//
}

private void button5_Click(object sender, System.EventArgs e)
{
//an instance

BDaq.BBDaqEnum Connected = new BDaq.BBDaqEnum();
Device1 = Connected.Devices("DAQ1");

Device1.Open();

//more code
}
}
}
 
P

Pete Davis

I doubt your COM component is going to be passing Sender and
System.EventArgs as parameters to your event. Those are .NET button click
event parameters. The parameters for your button5_Click() event need to
match the parameters of the Change event of your COM component.

Pete
 
B

Bradley Grant

I may be getting a little over my head, as I have been
programming in C# for only for about a year or so. I've
done some search on the net for information in this area,
and have not found much. Do you know of any good sources or
have any ideas what parrameters COM would pass to my
button5_Click() event would look like?

Any ideals would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top