P
Pavel Maly
Hello, I need some help with a DataGridView control and ProcessCmdKey method of the form. The
DGV is data-bound to an Access database table with a few NOT NULL columns. The ProcessCmdKey
method of the form is overloaded. I tried to use
return base.ProcessCmdKey(ref msg, keyData);
in the overloaded ProcessCmdKey when Escape keypress was detected, hoping DGV will take care of
the edit cancelling itself, but this ends up in "Null not allowed in column ..." exception. Then
I tried to use
dataGridView.CancelEdit();
return true;
instead of above mentioned base.ProcessCmdKey(...). The same exception popped up.
Problem description:
1. DGV is empty, only one blank row is present
2. user starts editing of the first row of the DGV
3. user cancels editing of the first row while some if the NOT NULL columns are still not filled in
4. "Null not allowed in column ..." exception comes up
If there is at least one row already filled in, no "Not null ..." exception seems to be
appearing. Why? Has it something to do with the detached row created when user starts editing
the new row? If so, how do I remove it manually? Is it even possible?
I'm starting to be desperate...
Any ideas?
TIA
Pavel
DGV is data-bound to an Access database table with a few NOT NULL columns. The ProcessCmdKey
method of the form is overloaded. I tried to use
return base.ProcessCmdKey(ref msg, keyData);
in the overloaded ProcessCmdKey when Escape keypress was detected, hoping DGV will take care of
the edit cancelling itself, but this ends up in "Null not allowed in column ..." exception. Then
I tried to use
dataGridView.CancelEdit();
return true;
instead of above mentioned base.ProcessCmdKey(...). The same exception popped up.
Problem description:
1. DGV is empty, only one blank row is present
2. user starts editing of the first row of the DGV
3. user cancels editing of the first row while some if the NOT NULL columns are still not filled in
4. "Null not allowed in column ..." exception comes up
If there is at least one row already filled in, no "Not null ..." exception seems to be
appearing. Why? Has it something to do with the detached row created when user starts editing
the new row? If so, how do I remove it manually? Is it even possible?
I'm starting to be desperate...
Any ideas?
TIA
Pavel