Bruce

Bruce

  • NA
  • 1
  • 0

Exiting edit mode DataGridView cell when closing formin VS2005

Oct 2 2008 2:55 PM
Hi all,

I am relatively new to .NET, C#, and DataGridView in particular.  I am working on existing code, with a form that contains three controls, one of which is a DataGridView.  If I am editing the data in a cell in the view, and then left click on parts of the other controls, the cell exits edit mode, as I would want it to, and when I choose to close the form I am correctly prompted as to whether or not I want to save the changes.  The problem I have is that, when I am in edit mode in a grid cell, and then choose to close the form without clicking on any other control in the form, I am not queried for a save.  The new value in the cell is never posted to the DataGridView control, and so the form knows nothing about needing to save the change, and the change is lost.  Is there an event I should be setting on the form so that when I choose File/Close from the form's menu it will cause any cell that is open for edit to exit edit mode?  I am not sure why it is working correctly when I click on another control, and not working as I would want it to when I choose File/Close.

One more question regarding this topic has to do with the fact that we are going to be moving to VS2008 (.NET 3.5) in a few months.  I am wondering if this issue is appreciably more easily handled in that version, so that I may do well to just wait until we make the move.  Either way, please send a 2005 answer if you would.  This is a somewhat pressing issue.

Thanks in advance for your help...
Bruce

Answers (1)