M
m.posseth
Hello
does someone know how i can invoke a method in the underlying thread without
the usage of a window handle ??
This works perfect in a form
Me.Invoke(New MethodInvoker(AddressOf ShowRecvdMessage))
however in a control i receive the folowing error
"Cannot call Invoke or InvokeAsync on a control until the window handle has
been created."
the complete routine that runs on a background thread:
Private Sub Listener()
done = False
Try
While Not done
Dim iPEndPoint As IPEndPoint = Nothing
Dim bs As Byte() = client.Receive(iPEndPoint)
Dim m As IMessage = NHS.Messaging.Util.RetrieveMessage(bs)
If Not m Is Nothing Then 'Return
message = m.MessageText
' need to use Invoke or BeginInvoke Syntax as message is on different
thread--
Me.Invoke(New MethodInvoker(AddressOf ShowRecvdMessage))
End If
End While
Catch e As Exception
multicastException(e)
End Try
End Sub
does someone know how i can invoke a method in the underlying thread without
the usage of a window handle ??
This works perfect in a form
Me.Invoke(New MethodInvoker(AddressOf ShowRecvdMessage))
however in a control i receive the folowing error
"Cannot call Invoke or InvokeAsync on a control until the window handle has
been created."
the complete routine that runs on a background thread:
Private Sub Listener()
done = False
Try
While Not done
Dim iPEndPoint As IPEndPoint = Nothing
Dim bs As Byte() = client.Receive(iPEndPoint)
Dim m As IMessage = NHS.Messaging.Util.RetrieveMessage(bs)
If Not m Is Nothing Then 'Return
message = m.MessageText
' need to use Invoke or BeginInvoke Syntax as message is on different
thread--
Me.Invoke(New MethodInvoker(AddressOf ShowRecvdMessage))
End If
End While
Catch e As Exception
multicastException(e)
End Try
End Sub