Click here to Skip to main content
16,015,641 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i use invokeGUIthread() and create a sub() within it as an action below is an example of what i have but it willnot compile
VB
 Private Sub softPhone_IncommingCall(ByVal sender As Object, ByVal e As VoIPEventArgs(Of IPhoneCall))
InvokeGUIThread(
   Sub()
      labelCallStateInfo.Text = "Incoming call"
      labelDialingNumber.Text = String.Format("from {0}", e.Item.DialInfo)
      phoneCall = e.Item
      WireUpCallEvents()
      inComingCall = True   
   End Sub )
End Sub
Posted
Updated 18-Jan-12 4:53am
v2

1 solution

You should declare your inner sub as it's own subroutine and add a delegate to it. Then, in your event handler you can check to see if an Invoke is required. If so, you invoke the delegate packing up any parameters and passing them into the delegate.

There is LOTS of info on marshalling calls to the UI thread. Including a number of C# and VB.NET projects on this web site that demonstrate the technique.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900