The following code is very slow. I was wondering if you can help me speed it up.
private void filter(List<CheckBox> boxList)
{
// refLanguageTabs is a TabControl the Tabcount is 9
for (int i = 0; i < refLanguageTabs.TabCount; i++)
{
Control[] ctrls = refLanguageTabs.TabPages[i].Controls.Find(refLanguageTabs.TabPages[i].Name + "Grid", true);
DataGridView dgv = ctrls[0] as DataGridView;
// average row count is 3000
for (int j = 0; j < dgv.RowCount; j++)
{
for (int k = 0; k < boxList.Count; k++)
{
if (dgv.Rows[j].Cells[1].Value.ToString() != boxList[k].Name.ToString())
{
dgv.Rows[j].Visible = false;
}
}
}
dgv.Refresh();
}
}