Hello,

I'm having trouble trying to update the Form1's text, I've tried the next code, but it throws this exception:

Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.

What am I doing wrong?

vb.net Code:
  1. Private Sub PercentCompleted(ByVal progress As Integer) Handles PercentDone.Progress
  2.         Dim deleg As New ProgressDone(AddressOf UpdateProgress)
  3.         Me.ProgressBar1.Invoke(deleg, progress)
  4.  
  5.     End Sub
  6.  
  7.     Private Sub UpdateProgress(ByVal e As Object)
  8.         Me.ProgressBar1.Value = CInt(e)
  9.         Me.Text = CStr(e) & "% Completed"
  10.     End Sub

Thanks in advance!!