Event handling problem (SMS)

G

Guest

Hi
Based on the "Receiving SMS sample" available in the SDK I built a class
that listens for messages and raises an event when a suitable SMS is
available. This event is then handled in a form (the form instantiates the
class "WithEvents" and declares a sub to handle the event with the "Handles"
keyword).

I get SMS on the form and access their text without any problem; the event
works fine. But I'm having trouble calling other subs or functions from
within the event handling routine. That is, if all the code is contained in
the event handling routine, the code works fine; if the event handler calls
other subs or functions with the same code then the control is transferred to
the called routine, but hangs when this latter is done. No exception is
raised, apparently. The program just hangs.

Any help? Thanks.
 
G

Guest

Please make sure that that you are not updating the UI from a different thread.
If that is the case you must use the Control.Invoke
 
G

Guest

Thank you, Alex. Your reply got me back on track. Thanks also to a previous
post on multiple threads and a control.invoke wrapper by Alex Feinman.
 

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