Forum Index > Using Comm64 as an run time instance - CommEvent.

By: JamesT Posted on: Apr 3 2012 at 11:23:00 AM
Hi, Another question from a Newbie!

I want to use Comm64 as an object created at run time (not a visual component on a form). I think this works - but how do I access the "Comm1_OnComm()" event handler in this case?

Thanks for any help.

By: Guest Posted on: Apr 3 2012 at 09:50:56 PM
When you create the object at run time you also need to create the event handler

By: Guest Posted on: Apr 4 2012 at 09:30:59 AM
Hi - thanks. In process of trying this. Just need to work my way around the multi-threading aspect of it!

By: Guest Posted on: Dec 13 2012 at 05:56:40 AM
Why mention Multi-Threading ?

I assume you are writing a multithreaded application. But if you're just talking about the Comms thread then you shouldn't need to worry about that.

If you were using the standard .Net SerialPort component and tried to update any UI in the DataReceived event (for example write text in a textbox) then you'd usually get an exception such as:-

Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.

That's because the DataReceived event of the standard .net serial component occurs on the component's own comms thread. You'd then need to Invoke up to your own event on the UI thread before you can update any UI.

But it's much easier when using the Comm64 component. You don't need to worry about threads. All the invoking is done within Comm64 so by the time the OnComm event is triggered it's already on the UI thread so you can update any UI without worrying about threads.

 

Reply - add comment to this topic
You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected
  Topic:- Using Comm64 as an run time instance - CommEvent.

Your Name


 


Forum scripts and databases - Copyright (c) 2009 - 2012 AxCoL.com