issue with check box behaviour in datagridview in c#.

Apr 2 2013 1:56 AM
I have a problem with the check box.I am using check box with the datagridview in windows forms in c#. when I check and uncheck the check box quickly( less than a sec),it is taking as checked.please help me
 
this is what i tried


if (e.ColumnIndex == dgCategoryView.Columns["chkSelectCategory"].Index&&e.RowIndex>=0) {
DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell();
ch1=(DataGridViewCheckBoxCell)dgCategoryView.Rows[dgCategoryView.CurrentRow.Index].Cells[0]; if (ch1.Value == null)
ch1.Value = false;
 switch (ch1.Value.ToString())
{
case "True":
for (int i = 0; i < Categoryrowlist.Count; i++)
{
 if (Categoryrowlist[i] == categoryList[e.RowIndex + currentC].Id)
{
Categoryrowlist.Remove(Categoryrowlist[i]);
 }
 }
 ch1.Value = false;
break;
case "False":
Categoryrowlist.Add(categoryList[e.RowIndex + currentC].Id);
 ch1.Value = true;
break;
}
}

Answers (1)