Well apparently you need to manually add the TableStyles. No more
exceptions, but the data the user has entered is still not saved with both a
true and a false passed to EndEdit()... I really don't want to force users to
hit enter after the last edit to confirm the change is made when they save a
table.
"GBayard" wrote:
> I have a DataGrid loaded from a Database. The app works great until I add
> code to save the cell the user is editing. I've broken up the code for easy
> reading as follows:
>
> int col = dataGrid.CurrentCell.ColumnNumber;
> int row = dataGrid.CurrentCell.RowNumber;
>
> // exception here:
> DataGridColumnStyle dgc = dataGrid.TableStyles[0].GridColumnStyles[col];
>
> catalogGrid.EndEdit(dgc, row, false);
>
> The line bellow the comment throws a 'System.ArgumentOutOfRangeException'.
> The datagrid is created before this code is called. The exception is thrown
> by the TableStyles collection, not the GridColumnStyles. Somehow 0 is out of
> range for the table styles, I don't get it... I will try some work arounds
> but if anyone has any ideas, let me know.
>
> Thanks,
> Greg
|