Hi,

I have a DataGrid which I databind as this:
BaseDataSetForUse.Tables["Market"].DefaultView.AllowNew = false;
BaseDataSetForUse.Tables["Market"].DefaultView.AllowDelete = false;
MarketGrid.DataSource = BaseDataSetForUse.Tables["Market"].DefaultView;

In the DataGrid, two columns is marked as readonly (In the definition of the
DataGridTextBoxColumn). If I in the WinForms-GUI, click in one of these
columns before I re-bind again, I will get an error in the re-bind code. The
re-binding of the DataGrid is done as the code above, that is I call the
same code snippet again, but I reset the DataSet first:

BaseDataSetForUse = BaseDataSetOriginal.Copy();

BaseDataSetForUse.Tables["Market"].DefaultView.AllowNew = false;
BaseDataSetForUse.Tables["Market"].DefaultView.AllowDelete = false;
MarketGrid.DataSource = BaseDataSetForUse.Tables["Market"].DefaultView;

When I set the DataSource, then I get the following error message:

"An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll

Additional information: Column 'IsExpired' does not belong to table Market."

I have debugged the code and the column is still in the DataTable. If I
doesn't click in one of the readonly columns, I do not get an error message.

Could anyone please help me?


--
Fredrik Arningsmark