I have two classes(Data_Reader And Display_Data) and a GUI_Form.
What i want is to Display the Read data of Data_Reader Class on Textbox which exists on GUI_Form so to wrap it i wrote Display_Data class .
But i got the folowing exception:
Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on
Can anyone knows how to solve this ? I just Want to update Read Data values on GUI Form.
//    Gui Form
//    ============
public partial class GUI_Form: Form
{
}
//    ==============
//    Display Data Class
//    ===========
public static class Display_Data
{
    public delegate void MyDelegate(Label myControl, string myArg2);
    public static void DelegateMethod(Label myControl, string myCaption)
        {
            myControl.Text = myCaption;
        } 
}
//=========================
//  Reader Class
//=========================
public void Data_Reader
{
    string Data_Received_text="Test";
    private System.ComponentModel.ISynchronizeInvoke _syn;
    Meter_Data_Class.packets_received_counter_status_display++;
    //it will call the display_Data class delegate method to update textbox on gui
    syn.BeginInvoke(new
                  Display_Data.MyDelegate(Display_Data.DelegateMethod),Data_Received_text);
}
 
     
    