views:

2692

answers:

3

I have a win form (c#) with a datagridview. I set the grid's datasource to a datatable.

The user wants to check if some data in the datatable exists in another source, so we loop through the table comparing rows to the other source and set the rowerror on the datatable to a short message. The datagridview is not showing these errors. The errortext on the datagridviewrows are set, but no error displayed.

Am I just expecting too much for the errors to show and they only show in the context of editing the data in the grid?

I have been tinkering with this for a day and searched for someone that has posted a simalar issue to no avail - help!

+1  A: 

I believe that the errors will only show on editing. What you could do is add a bool column to your DataTable, which drives the display of an image/custom column in the DataGridView, reflecting whether there is an error or not.

Robert Wagner
A: 

Check that AutoSizeRowsMode is set to DataGridViewAutoSizeRowsMode.None. I have found that the row Errortext preview icon is not displayed when AutoSizeRowsMode is not set to the default of none.

DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
Andrew
Doesn't seem to make a difference...
Simon
A: 

This is a bit late for the original poster, but here what solved it for me...

Check the row height. If it's less than 19 it will not draw the icon. Try setting it a bit higher to see if thats the problem.

grid.RowTemplate.Height = 22
eschneider