Thread Handling

  • Thread starter Thread starter OSVBNET
  • Start date Start date
O

OSVBNET

Guest
Hey all,

Need some advise since I'm not very good with threads:

Private Delegate Sub IncreaseProgressCallback(ByVal Value As Integer, ByVal ShowNumber As Boolean)
Private Sub IncreaseProgress(ByVal Value As Integer, ByVal ShowNumber As Boolean)
If ProgressBar.InvokeRequired Then
Dim d As New IncreaseProgressCallback(AddressOf IncreaseProgress)
Invoke(d, New Object() {Value})
Else
ProgressBar.Value = ProgressBar.Value + 1
If ShowNumber = True Then ProgressBar.Text = ProgressBar.Value.ToString + " of " + ProgressBar.Maximum.ToString
End If
End Sub

When InvokeRequired = False, the code runs fine, but when it's True, how to make the ProgressBar value to increase 1 by 1 like:

ProgressBar.Value = ProgressBar.Value + 1

Thanks for the tip.

Continue reading...
 
Back
Top