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
1060
What Event can I trap when I leave an empty unmodified cell
posted

I have a databound grid, works well.

If i try to leave a cell which had text in it and i emptied it.. the beforecellupdate event fires

if i am on a new row and i put something in the cell, again beforecellupdate fires

however if i do not add anything in that cell, beforecellupdate is not firing and i can now prevent empty cells

What am I missing ?

 

thanks

Parents
No Data
Reply
  • 1060
    posted

    the following works.. although i am not sure it's the right way to do it

     Private Sub grdModuleType_BeforeCellDeactivate(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles grdModuleType.BeforeCellDeactivate

                If _canceled Then

                    _canceled = False

                    e.Cancel = True

                    grdModuleType.PerformAction(UltraGridAction.EnterEditMode)

                Else

                    If grdModuleType.ActiveCell IsNot Nothing Then

                        If grdModuleType.ActiveCell.Column.Key.ToString = ModulesTypesColumn.Code.ToString Then

                            If String.IsNullOrEmpty(grdModuleType.ActiveCell.Value) Then

                                e.Cancel = True

                                MessageBox.Show(MainCommandeForm.CodeObligatoire, GlobalConstants.StrAttention, MessageBoxButtons.OK, MessageBoxIcon.Error)

                                grdModuleType.PerformAction(UltraGridAction.EnterEditMode)
                            End If
                        End If

                    End If
                End If



            End Sub

Children