views:

10

answers:

0

Here's my problem. I have 2 DataGridViews each on its own Tab. DGV2 (has at this moment no columns) is to be filled acc. to SelectedRow (ID) of the DGV1. I use tab_selectedindexchanged for that. I start BackgroundWorker to bind the DataSource and to manipulate DGV2 (insert certain columns, make some columns invisible, etc.). When I change Tab for the first time it's all right. When I am back to DGV1 and change a selected row in it and THEN change the Tab, an attempt to insert a column produces error. Before running BackgroundWorker I do as follows:

DGV2.DataSource = null; 
DGV2.BindingSource = null; 
DGV2.Rows.Clear(); 
DGV2.Columns.Clear();

Has anyone an idea what's wrong with my application? Thanks