I've been messing around with the answer given here How to update the GUI from another thread in C#?
I'm getting the error Method 'System.Windows.Forms.Label' Text not found from the following code
Private Delegate Sub setControlPropertyThreadSafeDelegate(control As Control, propertyName As String, propertyValue As Object)
Public Sub setControlPropertyThreadSafe(control As Control, propertyName As String, propertyValue As Object)
If control.InvokeRequired = True Then
control.Invoke(New setControlPropertyThreadSafeDelegate(AddressOf setControlPropertyThreadSafe), New Object() {control, propertyName, propertyValue})
Else
control.GetType().InvokeMember(propertyName, Reflection.BindingFlags.SetProperty, Nothing, control, New Object() {control, propertyName, propertyValue}) 'This is where the error occurs
End If
End Sub
From a separate thread I calling this method with the following line
UI.setControlPropertyThreadSafe(UI.lblExcel, "Text", "Inserting Data into YTD Template")
Any help regarding this error will be much appreciated.