I have two timers to control highligh/cancel value changed cells. It works well only for the first few runs, then no highlight happens even cell values are still changed. Could you please shet any light of how that happened? Here are my codes:
public Form1() {
myHighlighter = new Timer(); myHighlighter.Enabled = true; myHighlighter.Interval=5000; myHighlighter.Tick += HighLightChangedCells;
myCleaner = new Timer(); myCleaner.Enabled = true; myCleaner.Interval=1000; myCleaner.Tick += CancelHighlights; }
private void HighLightChangedCells(object sender, EventArgs e)
{
myCleaner.Stop();
DataTable dtNew = GetRandomData();
ultraGridView1.DataSource = dtNew;
foreach(UltraGridRow row in ultraGridView.Rows)
int i=row.Index;
int iNewValue = Convert.ToInt32( dtNew.Rows[i][0]);
int iSavedValue = savedValueArray[i];
if( iNewValue > iSavedValue )
row.Cells[0].Appearance = styleIncreased;
else if( iNewValue < iSavedValue )
row.Cells[0].Appearance = styleDecreased;
} ultraGridView1.Refresh();
SavePreviousValues(dtNew);
myCleaner.Start();
}
private void CancelHighlights(object sender, EventArgs e)
foreach(UltraGridRow row in ultraGridView1.Rows)
row.Cells[0].Appearance.BackColor = Color.White;
private DataTable GetRandomData()
DataTable dtRet = new DataTable();
Random rnd = new Random();
for(int i=0; i<SIZE; i++)
DataRow dr = dtRet.NewRow();
dr["Value"] = rnd.Next(100, 1000);
dtRet.Rows.Add(dr);
return dtRet;
private void Form1_Load(object sender, EventArgs e)
ultraGridView1.DataSource = GetRandomData();
myHighlighter.Start();
private void SavePreviousValues(DataTable dt)
savedValueArray[i] = Convert.ToInt32(dt.Rows[i][0]) ;
It's hard to tell from a code snippet like this, but I don't see anything obviously wrong. You should Submit an incident to Infragistics Developer Support and include a small sample project demonstrating the behavior so they can check it out.