'My Program Is Being Slow On CellFormating Event How Fix That?
I Have A Function In My CellFormating Event And That Function Have Two For Loop To Check That In A Row Exist A NULL Cell Or Not And Then Change The Row Header Of DataGridView
But My Program is Slow Down And I Cant Do Any Thing Any More How Can I Fix That ??
private void dgv_tests_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
RowHaveNull();
}
private void RowHaveNull()
{
for (int i = 0; i < dgv_tests.Rows.Count; i++)
{
for (int j = 0; j < dgv_tests.Columns.Count; j++)
{
dgv_tests.Rows[i].HeaderCell.Style.BackColor = MyGreen;
if (dgv_tests.Rows[i].Cells[j].Value == null || dgv_tests.Rows[i].Cells[j].Value.ToString() == "")
{
dgv_tests.Rows[i].HeaderCell.Style.BackColor = MyYellow;
break;
}
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
