Author: LukasMalik | Posted on: 8/22/2008 4:40:16 AM | Views : 374

Hi,

in my form I use BackgroundWorker, .DoWork event id handled with this method

private void oWorker_DoWork(...)

{

    comDataGrid1.DataSource = myDataTable; // here I add DataTable loaded from SQL as DataSource and here is cross-threading exception thrown...
}

comDataGrid1 is instance of class comDataGrid which is my custom user control, containing only DataGridView and Label.

propert DataSource of comDataGrid class does simple operation:

public object DataSource

{

 set { this.DataGridView1.DataSource = value;}

 get { return this.DataGridView1.DataSource;}
} 

Do I have to implement Invoke method to my control? Where may be the problem then? If I add .standard DataGridView to form and try to fill its DataSource as with custom control, operation completes OK.

 

Thanks
...

Go to the complete details ...