Event handling problem (SMS)

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
Back
Top