Yes, but you must update the user interface elements in the user interface stream using Dispatcher.Invoke .
Example in C #: instead
myTextBox.Text = myText;
using
Dispatcher.Invoke(new Action(() => myTextBox.Text = myText));
VB.NET (before version 4) does not support anonymous methods, so you have to deal with an anonymous function:
Dispatcher.Invoke(Function() UpdateMyTextBox(myText))
...
Function UpdateMyTextBox(ByVal text As String) As Object
myTextBox.Text = text
Return Nothing
End Function
Alternatively, you can start your background threads using the BackgroundWorker class , which supports updates in the user interface through ProgressChangedand RunWorkerCompletedevents: both events automatically occur in the user interface stream. An example of using BackgroundWorker can be found here: SO question 1754827 .
source
share