issue with check box behaviour in datagridview.

Apr 1 2013 3:31 AM
i have problem with check box.when i use check box with datagridview,when i check and uncheck quickly less than one sec ,it is taking as checked else it is working normally.pls help me. for reference view my code .

 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);
                        //System.Threading.Thread.Sleep(3000);
                        ch1.Value = true;
                        break;
                   
                }
            }