Skip to content
C#
private void dgView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 8)
            {
                dgView.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange);
                var val = dgView["All", e.RowIndex].Value;......

今天写到DataGridView里的CheckBox选中或取消时并不能立即获取值。查了下,加上红色标记的代码,立即提交变更。即可。

转换自: https://www.cnblogs.com/atwind/archive/2013/05/21/3090741.html