Friday 22 February 2013

At a time check Multiple checkbox in a gridview in Window application


 private void DGVFormula_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

            try
            {
                DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell();
                ch1 = (DataGridViewCheckBoxCell)DGVFormula.Rows[DGVFormula.CurrentRow.Index].Cells[0];

                if (ch1.Value == null)
                    ch1.Value = false;
                switch (ch1.Value.ToString())
                {
                    case "True":
                        ch1.Value = false;
                        BtnDelete.Visible = false;
                        break;
                    case "False":
                            ch1.Value = true;
                            BtnDelete.Visible = true;
                            count++;
                            break;
                   
                }

            }
            catch (Exception ex)
            {
            }
}

No comments:

Post a Comment