Datagrid SetColumnerror

rjjebs

Member
Joined
Feb 7, 2007
Messages
10
Programming Experience
5-10
I have a VB.Net Windows form with a datagridview. I populate the grid from a datatable. In my DataGridView1_CellValidating event I check the values of the cell, if it is invalid I set the datarow.setcolumnerror. This works fine I get the error icon in the correct cell with the error tooltip. My problem is when I correct the error and I do a drow.clearerrors, not only does the error icon disappear but it also clears out all my data entered into all the cells for the row.

any comments?

I am useing VS 2008 .net 2.0
 
I'm assuming you're setting your column error like:

VB.NET:
datarow.SetColumnError("YourColumnName", "Please specify a valid widget.")

To clear it you'd:

VB.NET:
datarow.SetColumnError("YourColumnName", "")

I'd recommend checking out this video How Do I: Add Validation?
 
Datagrid Setcolumnerror

Thanks for such a quick reply, yes I have tried both the datarow.SetColumnError("YourColumnName", "") and the drow.clearerrors, both ways my data is cleared out of my datagrid. I will take a look at the video as you suggest.
 
Back
Top