Handle data error in datagridview.

  • Thread starter Thread starter Huy Nguyen
  • Start date Start date
H

Huy Nguyen

Hello,
How can i force the cell to accept the input for now and flag it as error
for user to correct it later.

For Example:
case 1.
I have a column that is NOT bound to database table, then I can flag the
cell for error and move on to the next cell.
If isNumeric(DataGridView.CurrentCell.Value) = False Then
DataGridView.CurrentCell.ErrorText = "Invalid value, must be
number only"
End If
The cell will have an "!" mark on it with the error message attatched to
it.


case 2
Now, I am trying to do this with a column that bound to a database
table. And the value for this column in database is define as an Int. If I
try to enter in a non numeric value for the cell then it will call the
"dataError" event. When this happen, it will force me to stay at the current
cell until the error is fix.

Is there anyway that I can force the cell to accept the invalid value
and flag it with a "!" mark like above ?

I am sorry if I confuse you on this, and if you are, please let me know,
I'll try to explain again. Thanks
H
 
Hyy,

You can use the errorstate of a datarow for that, then AFAIK will there be a
sign from the error provider. (I am not sure for the DataGridView however
that is the way in the DataGrid, I assume the same for the DataGridView).

Cor
 
Cor,
Thank you for getting back with me on it. However, I am not quite sure
what you mean on this. Could you please give me an example? code snippet
should be great. Thanks
 
Back
Top