Question : Dynamic datagrid view with check box

Hi, I am doing windows application using C#.Net. I can create data grid view with check box(first column) dynamically.At the time of creation i mentioned as colum[0].value=false.
                       But i want to check at every checked changes ,whether the check box checked or not  .
I tried to check this at CellLeave Event.But all the times  i  am getting  the checked value is "False". If i mentioned "True" at the time of creation then it show "True". I did not get correct value.Please guide me how to solve this issue

Answer : Dynamic datagrid view with check box

Hi,
  The solution is , we have to type cast sender to DataGridView and retrieve the cell value from that grid view only.have attached sample code :
1:
2:
3:
4:
5:
DataGridView dgv = ((DataGridView)sender);
            if (dgv.Rows[e.RowIndex].Cells[e.ColumnIndex] is DataGridViewCheckBoxCell)
            {
                MessageBox.Show(dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() + " " + ((DataGridView)sender).Name);
            }
Random Solutions  
 
programming4us programming4us