Basically what I have is a datatable that is bound to a DataGridView. What I want to happen is to show a error type tooltip in each of the cells in the datagrid if some exception is true.
I have been able to get the red error alert to show in the cells using CellValidating. The problem is that the user would have to click on a cell and then take that cell out of focus for the alert to become visible.
I also tried using ColumnChanging on the datatable to set the RowError but that didn't work at all. Here is some sample code that I had tried.
importGrid
is my DataGridView
,
csvData
is my DataTable
private void importGrid_CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
this.importGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText ="Drive Letter in use";
}
private void csvData_ColumnChanging(object sender,
System.Data.DataColumnChangeEventArgs e)
{
e.Row.RowError = "test error";
e.Row.SetColumnError(e.Column, "test error 2");
}