How to make Dispatcher.BeginInvoke run in background in VB.net?

感情迁移 提交于 2019-12-01 13:37:04

The dispatcher should be used to update UI objects from a separate thread, it does not actually spawn up the thread for you. If you are using .NET 4.0 or higher, you can use the TPL library to spawn your thread, do your work, then update your UI object via the dispatcher from the background thread.

Task.Factory.StartNew(Sub() DoBackgroundWork())

Then, inside DoBackgroundWork whenever you want to update your UI...

Dispatcher.BeginInvoke(Sub() txtBox1.Text = "End")

boxsp

you can call to the general application.

Application.Current.Dispatcher.Invoke()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!