N
nvx
Hi,
could anyone please explain to me what exactly is happening when I
press ESC while editing a data-bound DataGridView?
The problem is I have a data-bound DataGridView and overriden
ProcessCmdKey function and when I press ESC, it produces DB column
constraint exception ("not null") for a column, which has not been
filled in yet.
I managed to find an ugly but working solution for a DGV with
DefaultView.RowFilter not set:
if (dSet.Tables["tblname"].Rows.Count == 0)
{
dSet.Tables["tblname"].Rows.Clear();
}
dataGridView.CancelEdit();
In case the DefaultView.RowFilter is set and DefaultView contains no
rows while the actual table contains one or more rows, I obviously can
not clear all rows of the DataTable and dataGridView.CancelEdit();
alone produces the above mentioned null-not-allowed exception. It is
all about getting rid of the detached row, I guess...
So, does anyone know what should I do when the RowFilter is set?
Thanks for any help...
With regards
nvx
could anyone please explain to me what exactly is happening when I
press ESC while editing a data-bound DataGridView?
The problem is I have a data-bound DataGridView and overriden
ProcessCmdKey function and when I press ESC, it produces DB column
constraint exception ("not null") for a column, which has not been
filled in yet.
I managed to find an ugly but working solution for a DGV with
DefaultView.RowFilter not set:
if (dSet.Tables["tblname"].Rows.Count == 0)
{
dSet.Tables["tblname"].Rows.Clear();
}
dataGridView.CancelEdit();
In case the DefaultView.RowFilter is set and DefaultView contains no
rows while the actual table contains one or more rows, I obviously can
not clear all rows of the DataTable and dataGridView.CancelEdit();
alone produces the above mentioned null-not-allowed exception. It is
all about getting rid of the detached row, I guess...
So, does anyone know what should I do when the RowFilter is set?
Thanks for any help...
With regards
nvx