With Option Explicit On I get a implicit coversion error with the code listed below.
If I turn off option explicit I get a warning, but it compiles and runs fine.
I can not figure out how to rewrite this to get the conversion right.
I use this code to pass some text up to the main form from a background worker.
Thoughts?
Thanks,
Keith
'used to set form objects with data from background workers
Public Sub SetText(ByVal [text] As String)
' InvokeRequired required compares the thread ID of the
' calling thread to the thread ID of the creating thread.
' If these threads are different, it returns true.
If Me.TextBox1.InvokeRequired Then
Dim d As New ContextCallback(AddressOf SetText)
Me.Invoke(d, NewObject() {[text]})
Else
Me.TextBox1.Text = [text]
End If
End Sub
If I turn off option explicit I get a warning, but it compiles and runs fine.
I can not figure out how to rewrite this to get the conversion right.
I use this code to pass some text up to the main form from a background worker.
Thoughts?
Thanks,
Keith
'used to set form objects with data from background workers
Public Sub SetText(ByVal [text] As String)
' InvokeRequired required compares the thread ID of the
' calling thread to the thread ID of the creating thread.
' If these threads are different, it returns true.
If Me.TextBox1.InvokeRequired Then
Dim d As New ContextCallback(AddressOf SetText)
Me.Invoke(d, NewObject() {[text]})
Else
Me.TextBox1.Text = [text]
End If
End Sub