Unconfirmed, but it should be close enough. I read an article or ten about it once when I had the same problem. The trick is to immediately fix the edit when you click on the box, which then raises the CellValueChanged event. Then you can pick up an account.
This should update the text box when you check the box and clear the check box:
private void dgv_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (dgv.IsCurrentCellDirty && dgv.CurrentCell.OwningColumn.Name == "MyCheckColumn") dgv.CommitEdit(DataGridViewDataErrorContexts.Commit); } private void dgv_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1)
Hope Linq works. If not, you will have to do it in the old fashioned way of foreach with a variable amount. I know that DataGridViewRowCollection can sometimes be skinny.
source share