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
295
User cant delete DateTime value in grid
posted

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?