PhilMellorDev
asked on
Update Form based on classed Thread Activity
Hi All,
Can someone please tell me how to show information on a winform based on a (classed) thread's progress. What I mean is, the thread executed as a different class and I can't find a relevant code example.
Can someone please tell me how to show information on a winform based on a (classed) thread's progress. What I mean is, the thread executed as a different class and I can't find a relevant code example.
Public Class frmProgress
Public Sub doQueue(maxConcurrentThreads As Integer)
ThreadPool.SetMaxThreads(maxConcurrentThreads, maxConcurrentThreads)
Dim i As Integer = 0
Dim max As Integer = lines.Count
While i < (max)
Dim caller As New SingleThreadCaller(lines(i))
ThreadPool.QueueUserWorkItem(AddressOf caller.SingleThreadDoer)
i = i + 1
End While
End Sub
End Class
Public Class SingleThreadCaller
Public Sub New(DRow As Object)
Me.rowData = DRow
End Sub
Public Sub SingleThreadDoer()
Dim s As String = Me.buildString
If s <> "" Then
'Then do start query
'HELP HERE PLEASE
frmProgress.setText("Doing Stuff")
End If
End Sub
Public Function buildString()
'etc
Return s
End Function
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry...change:
Me.BeginInvoke(New ProgressUpdate(AddressOf stc_Progress), New Object() {status})
To:
Me.BeginInvoke(New ProgressUpdate(AddressOf stc_Progress), New Object() {sender, status})
Me.BeginInvoke(New ProgressUpdate(AddressOf stc_Progress), New Object() {status})
To:
Me.BeginInvoke(New ProgressUpdate(AddressOf stc_Progress), New Object() {sender, status})
ASKER
Thanks Idle_Mind! Your solution was exactly what I was looking for!
ASKER
It looks right from what I've read, but when I try to execute it I get "TargetParameterCountExcep
Thanks,
Phil