Thursday, 27 December 2012

grideview check box checked

 private void DgviewStock_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell();
                ch1 = (DataGridViewCheckBoxCell)DgviewStock.Rows[DgviewStock.CurrentRow.Index].Cells[0];

                if (ch1.Value == null)
                    ch1.Value = false;
                switch (ch1.Value.ToString())
                {
                    case "True":
                        ch1.Value = false;
                        panel1.Visible = false;
                        break;

                    case "False":
                        ch1.Value = true;
                        DgviewStock.CurrentCell = DgviewStock.Rows[e.RowIndex].Cells["Copies"];
                        break;
                }
            }
        }

No comments:

Post a Comment