开发者

Help with Dispatcher.BeginInvoke

开发者 https://www.devze.com 2023-03-31 17:07 出处:网络
I am trying to call a method that started on a background thread on the UI thread calling BeginInvoke and passing in a delegate as follows:

I am trying to call a method that started on a background thread on the UI thread calling BeginInvoke and passing in a delegate as follows:

Di开发者_如何学运维spatcher.BeginInvoke(Function() UpdateApplicationDataUI()) 

to call this method:

Private Sub UpdateApplicationDataUI()
...
End Sub

However, I get an error in the call to BeginInvoke (the UpdateApplicationDataUI portion of the delegate is stating "Expression does not produce a value"). I'm sure I'm missing something simple...any ideas?

Did more research and answered my own question:

Me.Dispatcher.BeginInvoke(Function() New Action(AddressOf UpdateApplicationDataUI))


I think the syntax in VB.net for this is

Dispatcher.BeginInvoke(Sub() UpdateApplicationDataUi())
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号