У меня проблема: при попытке изменить текст массива меток (label (1) .text = "Lol"), я получаю сообщение об ошибке:
"Cross-thread operation not valid: Control 'lblCSCH1' accessed from a thread other than the thread it was created on."
Код такой:
Private Sub Cliente_Receive(ByRef message As String) Handles Cliente.Receive
Dim anterior As String
Dim corte As Integer
Dim canal As String
Dim lblCSCH() As Label = {lblCSCH0, lblCSCH1, lblCSCH2, lblCSCH3, lblCSCH4, lblCSCH5, lblCSCH6, lblCSCH7, lblCSCH8, lblCSCH9, lblCSCH10}
If Microsoft.VisualBasic.Left(message, 3) = "<ch" Then
corte = InStr(message, ">")
If corte > 0 Then
corte = corte - 1
canal = Replace(LTrim(Replace(Replace(Replace(Replace(Microsoft.VisualBasic.Left(message, corte), "h", ""), "c", ""), "<", ""), "0", " ")), " ", "0")
'After this i Get just a number, for example 1 or 2
lblCSCH(canal).Text = canal
End If
End If
End Sub
Как мне решить эту проблему?