Hello,
I'm working on an older application now which uses Ultragrid v3.1.
In the ultragrid the user can enter a date (with mask __/__/____). If there is allready a date in the cell and the user wants to clear it, he'll get an error when he leaves the cell ("Unable to update the data value: Value in the editor is not valid") . When there is a DBNull value in the database the ultragrid just shows an empty cell.
I want the user to be able to clear the date so that the cell will be empty again.
This Is what I've tried so far.
Private Sub UltraGridKlantengroep_Error(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.ErrorEventArgs) Handles UltraGridKlantengroep.Error Dim thisUltragrid As Infragistics.Win.UltraWinGrid.UltraGrid = CType(sender, Infragistics.Win.UltraWinGrid.UltraGrid) If (thisUltragrid.ActiveCell.Text = "__/__/____") Then Me.UltraGridKlantengroep.ActiveCell.Value = DBNull.Value End If e.Cancel = True End Sub
If I do this I get an unhandled exception:
Internal error: can't get masked editor value.
Inner exception: Input does not match the mask.
Any ideas how I can fix this?
Hi,
That's a really old version of the grid, so this might be a bug in the version you are using.
Try setting the Nullable property on the column to DBNull and see if that helps. If not, you might want to try some of the other values for that property and see if any of them work.
Setting the Nullable property to the different values didn't work (DBNull is null here)
It is the DateTimeEditor which throws the exception, because the mask isn't respected.
Is there a possibility to in case of an error put another editor on this cell?
Or any other solutions?