伙计们,
我的 frmMain 类上有一个函数,它将在调用后将我的控件更新为其他内容。当我在即时窗口上键入“?Label1.Text”时,文本属性已更新,但是当我检查表单时,什么也没发生。代码是这样的
Public Sub UpdateUI()
If (Me.InvokeRequired = True) Then
Invoke(New MethodInvoker(AddressOf UpdateUI))
End If
Label1.Text = "ITS NOT WORKING =\"
End Sub
在我的 bgWorker 类上:
Private threadUpd As New Threading.Thread(AddressOf Updater)
Private _active as Boolean
Public Sub New()
_active = True
threadLimpar.IsBackground = True
threadLimpar.Start()
End Sub
Public Sub Updater()
Do
If (_active = False) Then
Try
Thread.Sleep(Timeout.Infinite)
Catch ex As ThreadInterruptedException
End Try
Else
if(condition...) then
frmMain.UpdateUI
End if
Loop
End Sub