Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何更改dataGridView中的提交值?_C#_Events_Datagridview - Fatal编程技术网

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

C# 如何更改dataGridView中的提交值?,c#,events,datagridview,C#,Events,Datagridview,我有一个dataGridView,其中有一列带有复选框。每当用户单击复选框时,我都会使用事件CellContentClick来处理必要的操作 但现在,在某些情况下,我希望不提交该值(复选框未选中)。你知道怎么做吗?你可能想看看这个活动。比如说: void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { object new_value = e.FormattedValu

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


但现在,在某些情况下,我希望不提交该值(复选框未选中)。你知道怎么做吗?

你可能想看看这个活动。比如说:

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;
   }
}