我正在调用线程函数中的类函数。我正在使用invoke方法将值发送到主窗体中的进度条,我不知道如何在线程函数调用的其他类函数中执行此操作。在线程中调用函数调用的信息状态值
我的目标是从线程函数甚至线程函数调用的函数向进度条发送一个值到主窗体。
我的代码: “调用子 公用Sub UpdPgEvent(BYVAL值作为整数) Me.pgFindEvent.Value =值 结束小组
' Sub started by the thread
Private Sub ThreadTaskMonitor()
Dim ConnectURL As String
' Delegate progressbar
Dim DelegPgEvent As DelegueUpgPbEvent = New DelegueUpgPbEvent(AddressOf UpdPgEvent)
' This invoke works great
Me.Invoke(DelegPgEvent, 10)
ConnectURL = "..."
Me.Invoke(DelegPgEvent, 20)
' What I want is to send state value from this call to the main form progressbar
urlr.JsonGetEvents(ConnectURL)
Dim table_res As List(Of monitor_table) = urlr.ConstructDataMonitor()
Me.Invoke(DelegPgEvent, 80)
Me.MonitorBindingSource.DataSource = table_res
Me.Invoke(DelegPgEvent, 90)
mon.dbMonitor.DataSource = Me.MonitorBindingSource
Me.Invoke(DelegPgEvent, 0)
End Sub
感谢您的帮助
你能修改urlr类吗?如果是的话,在那里举办活动并在你的调用课堂内处理它。 – nik 2012-03-04 12:47:30