Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
WinGrid V17.1 exception InvalidOperationException: Operation can not be performed when not in edit mode.
posted

We've upgraded our WinForms project from 15.2 to 17.1.  

When editing (changing a cell value) and leaving the ultrawingrid the exception occurs, it's not being caught within the VS 2017 IDE as I've set it to break on this exception.  

The code is quite old, I think it's going wrong in this part of the code, as I've stepped through the code and set the activecell to nothing, which stops the exception occuring.

Dim ThisCell As UltraGridCell = Me.ActiveCell
If Not ThisCell Is Nothing Then
If ThisCell.IsInEditMode Then
Me.PerformAction(UltraGridAction.ExitEditMode, False, False)
If ThisCell.IsInEditMode Then
OutputTrace(ts.TraceWarning, "Cannot exit edit mode on leave, cell and row may not be updated or validated")
End If
End If
If IsDirty(ThisCell) Then
Dim ThisE As New CancelableCellEventArgs(ThisCell)
RaiseEvent ValidateCell(ThisGrid, ThisE)
If ThisE.Cancel Then Me.Focus()

ElseIf mValidationModeCell = IProgressDataEntryGrid.ValidationModeConstants.Always Then
Dim ThisE As New CancelableCellEventArgs(ThisCell)
RaiseEvent ValidateCell(ThisGrid, ThisE)
If ThisE.Cancel Then Me.Focus()

Else
'nothing to validate on cell
End If
End If

Has there been any changes in this area that would affect the operation, if so do you have any recommendations?

Many thanks

Keith