gpt4 book ai didi

c# - 如何更改dataGridView中的提交值?

转载 作者:行者123 更新时间:2023-11-30 18:05:50 25 4
gpt4 key购买 nike

我有一个 dataGridView,其中有一列带有复选框。每当用户单击复选框时,我都会使用事件 CellContentClick 来处理必要的操作。

但现在,在某些情况下,我希望不提交该值(取消选中复选框)。知道如何做到这一点吗?

最佳答案

您可能想查看 CellValidating事件。所以像这样:

void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
object new_value = e.FormattedValue;
// Do something
// If you dont like what you did, cancel the update
if(nope_didnt_like_it)
{
e.Cancel = true;
}
}

关于c# - 如何更改dataGridView中的提交值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5168503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com