views:

70

answers:

1

I've a DataGridView which is working perfectly fine. I use it just to show data.

Now I want ability to select rows by check box and perform an operation for only selected rows on click of a button (this button is out of the grid on the same form). For this purpose, I'm following these steps to add checkbox column to datagridview.

On running the application what is see is I can't check the check box either by mouse click or keyboard. And by its looks I can understand that its not in disabled/readonly state. So whenever I try to click on the checkbox, it changes it's borders normally as an enabled check box does. But finally it is not checking the check box.

+1  A: 

Try it.

 private void Form1_Load(object sender, EventArgs e)
    {
        DataGridViewCheckBoxColumn ck = new DataGridViewCheckBoxColumn();
        dataGridView1.Columns.Insert(0,ck);
    }

may help you.

Ismail here is your solution of your confusion Dgv-DatabindingCompleteEvent

mahesh
Very strange. It works!!!! Still don't know why it doesn't work when added at design time
Ismail
I have a datagrid working with the Checkbox column added in XAML so it's not that this won't work, seems like there is something else going on.
Mark
@Ismail, Here is above i putted the link which should guide you when should you call this event handler
mahesh