Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to access COM components events in c#

Posted on 2006-11-15
3
Medium Priority
?
458 Views
Last Modified: 2013-11-25
I am writing a class library that uses some third party COM components as well as serial comms

I need to know how to access the events associated with these controls - for example:

I have successfully set up a serial comms object using by referencing Microsoft’s comm control 6 in my .net project i.e

 MSCommLib.MSComm port = new MSCommLib.MSComm();

I can then successfully open close the port and set all the relevant properties

eg

port.CommPort = 1;
port.PortOpen = true;

etc..

My problem is how do I access the port.OnComm() event. I have exactly the same problem with some third party controls that work with a specific piece of hardware  I can set the properties but I'm not sure how to get at the events.

Any help would be apreciated.


Regards
0
Comment
Question by:Vitech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
SCDMETA earned 1600 total points
ID: 17950289
If you start typing the following, Visual Studio will start prompting you through the rest:

port.OnComm += new MSCommLib.DMSCommEvents_OnCommEventHandler(port_OnComm);

private void port_OnComm()
{

}
0
 
LVL 1

Author Comment

by:Vitech
ID: 17955053
Thanks for that, but there’s one more thing. The above codes works but the new Port_OnComm routine is created as a method for my class. I really need it to create an event for my class so that in the program that uses the library i can use the following code example

MyClass.port_OnComm += new EventHandler(MyClass_port_OnComm)


Currently this fails with the following error

Cannot assign to port.OnComm' because it is a 'method group'      

Thanks
 
0
 
LVL 1

Author Comment

by:Vitech
ID: 17955313
Don't wory about the above comment I've wroked it out

Tanks for your help

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question