更新DataGridView单元格值 [英] Update DataGridView Cell value

查看:92
本文介绍了更新DataGridView单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个DataGridView控件,其中包含几列,其中一列是CheckBoxColumn.单击此列中的任何CheckBoxes都会触发CellContentClick事件,该事件使用单击的CheckBox的值来执行任务.但是,在单元格失去焦点之前,CheckBox的值似乎没有更新,这对我要实现的任务来说是个问题.

有人帮我解决这个问题吗?谢谢.

排序使用网格的CommitEdit方法.

Hi,

I have a DataGridView control containing several columns one of which is a CheckBoxColumn. Clicking any of the CheckBoxes in this column fires the CellContentClick event which perfoms a task using the value of the clicked CheckBox. However, the value of the CheckBox doesn''t seem to update until the cell loses focus, which is a problem for the task I am trying to achieve.

Anybody help me on this one? Thanks.

EDIT : Sorted it I think using the CommitEdit method of the grid.

于2009年8月5日星期三上午7:46修改
modified on Wednesday, August 5, 2009 7:46 AM

推荐答案

CellContentClick事件,您将在单元格的EditedFormattedValue属性中而不是在Value属性中获取更新后的值.

In the CellContentClick event, you will get the updated value in the EditedFormattedValue property of the cell and not in the Value property.


这篇关于更新DataGridView单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆