Hello all,
I have a DataGridViewCellValidating function that sets the error text based on a particular cell's input. It calls a function called "HighlightErrantCell" which ensures the user cannot leave the problem cell without fixing it.
A MessageBox seems abrupt, but I would like some kind of animation so the user doesn't think my application is frozen when they try to click another cell. I put a loop at the end of my HighlightErrorCell, but it doesn't do anything I notice.
Here's what I have so far:
private void HighlightErrantCell(int RowIndex)
{
string err = grdUsers.Rows[RowIndex].ErrorText;
//Focus on the proper cell based on the error text.
.
.
.
//Animate the ErrorText flashing
for (int i = 1; i <= 3; i++)
{
System.Diagnostics.Debug.WriteLine("Clearing Error text.");
grdUsers.Rows[RowIndex].ErrorText = null;
grdUsers.UpdateRowErrorText(RowIndex);
grdUsers.InvalidateRow(RowIndex);
System.Threading.Thread.Sleep(300);
System.Diagnostics.Debug.WriteLine("Setting Error text.");
grdUsers.Rows[RowIndex].ErrorText = err;
grdUsers.UpdateRowErrorText(RowIndex);
grdUsers.InvalidateRow(RowIndex);
System.Threading.Thread.Sleep(300);
}
}
Thank you in advance.