Hi I am trying to call a Sub from another thread but it always throwing me an error: Cross Thread is not valid.

here is the Sub I am calling from other thread.

vb Code:
  1. Private Delegate Sub AppendToLogInvoker(ByVal strText As Object, ByVal color As Integer)
vb Code:
  1. Private Sub WriteToLog(ByVal strText As Object, ByVal color As Integer) 'As Object
  2.         If Me.Log.InvokeRequired Then
  3.             Me.Log.Invoke(New AppendToLogInvoker(AddressOf WriteToLog), strText, color)
  4.         End If
  5.         Me.Log.SelectionStart = Len(Log.Text)
  6.         Me.Log.SelectionColor = System.Drawing.ColorTranslator.FromOle(color)
  7.         Me.Log.SelectedText = strText
  8.         Me.Log.SelectionStart = Len(Log.Text)
  9.         Me.Log.SelectedText = vbCrLf
  10.     End Sub

I am calling that on other thread with this:
vb Code:
  1. WriteToLog(" [" & System.DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss") & "]  " _
  2.                        & "ERROR: Sending failed! " _
  3.                       , System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red))

I am getting stock at this point


vb Code:
  1. Me.Log.SelectionStart = Len(Log.Text)