I have a dataGridView that has a column with checkb开发者_如何学运维oxes. Whenever the user clicks on a checkbox I use the event CellContentClick where I process the necessary action. 
But now, in some cases, I would like the value not to be committed (the checkbox to be unchecked). Any idea how to do this?
You might want to look at the CellValidating event. So something like this:
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;
   }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论