Hi there,
I have a question in datagrid view , hwat I want is when a user edits a datagridview cell in a row in the datagridview I want to check a check box in the same row, how can I do this and what is the event that I have to write the code in???

Thankx in avvance

Recommended Answers

All 2 Replies

I think the event you will want to use is CellEndEdit. here is an example
where the datagridview is named dgvMetrics.

private void dgvMetrics_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow dgvr = dgvMetrics.Rows[e.RowIndex];
            dgvr.Cells["chkbx"].Value = true
        }

you can reference the cell by its index position or it name which in this case is chkbx

If you are ever unsure about which event to use you can always check the msdn reference for the class/control you are using. It has a very comprehensive list of the events and when they are raised:

CellEndEdit: Occurs when edit mode stops for the currently selected cell.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.