Re: cross-thread UI updating?

Tech-Archive recommends: Fix windows errors by optimizing your registry



On May 23, 4:41 pm, Tim Van Wassenhove <t...@xxxxxxxxxxxxxxxx> wrote:
Here is a pattern i very often see for thread-safe updates of the UI...
(Method defined in a class that derives from Form)

thanks, tim. but can you help me put this in context? for instance,
heres some pseudo code i have now:

SomeForm.vb
--------------

'bad, because GetMyData() is binding its data (from a thread) back to
the UI:
Private Sub SomeForm_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim getDataThread As Thread = New Thread(AddressOf GetMyData)

If Not getDataThread.ThreadState = Threading.ThreadState.Running
Then
getDataThread.IsBackground = True
getDataThread.Start()
End If

End Sub

....but im a bit in the dark as to how the .Invoke pattern works w/
this, how it ties back into my code. can you shed any light on this?


thanks!
sm

.



Relevant Pages