现在的位置: 首页 > 综合 > 正文

在DataGridView中的CheckBox值变更后立即获取值。

2012年12月12日 ⁄ 综合 ⁄ 共 273字 ⁄ 字号 评论关闭
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选中或取消时并不能立即获取值。查了下,加上红色标记的代码,立即提交变更。即可。

抱歉!评论已关闭.