Home Forums WinForms controls Xceed Grid for WinForms Exception on collapse Reply To: Exception on collapse

User (Old forums)
Member
Post count: 23064

I’m no expert here (have a pending issue myself), but I’m curious as to exactly what point you are cancelling the edit of the cell?  If you’re interested in cancelling the edit of a cell then the cell has two good places to cancel the edit: LeavingEdit & ValueChanging.  If you’re interested in cancelling the edit of the DataRow: EndingEdit.  All have event arguments that support a cancel property.  No clue why the first click isn’t doing anything though.  Those pesky first chance exceptions?

I just poked around on what I was working with, using DataRow.EndingEdit, and collapsing the parent row does envoke the EndingEdit routine and setting cancel to true does bypass DataRow.EditEnded.  (Interesting refresh of the grid while in design mode though.)  If you want to isolate just the error you are getting you might want to look at the cell’s LeavingEdit event instead so that EndEdit of your error dump will be bypassed.

Public Event LeavingEdit(ByVal sender As Object, ByVal e As Xceed.Grid.LeavingEditEventArgs)
     Member of: Xceed.Grid.Cell
Summary:
Raised after a cell has been edited to validate the content of the cell.

Remarks:
Custom validation can be provided in the LeavingEdit event. In this event, if the validation process fails, setting e.Cancel to true will cause the ValidationError event to be raised.  Setting e.CancelEdit to false in the ValidationError event will prevent the cell from leaving edit mode in the case where the its value fails the validation process.

Imported from legacy forums. Posted by Hobart (had 463 views)