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
186
Wingrid BeforeCellDeactivate will not fire
posted

I have 2 projects both using the same methods of cell validation (based on Infragistice Knowlwdge Base article KB01747). In the first project it works fine. However in the second the BeforeCellDeactivation event will not fire. Therefore the user is not directed back to the cell to enter the proper data. The code between the 2 projects are almost identical. The difference primarily being the criteria the data is validated against. But that should have no effect on the event not firing.

Code snipits from the failing project:

THIS FIRES properly & when it should:

 

 

 

 

 

 

 

Private Sub UGridWeights_BeforeCellUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs) Handles

UGridWeights.BeforeCellUpdate

 

 

Select Case

e.Cell.Column.Key

 

 

Case

"WeightClass"

 

 

If ValidWeight(e) = False Then

c_cellBadCell = e.Cell

 

 

End

Select

 

 

End

Sub

This is the code of the Event that does not fire:

Private

 

Sub UGridWeights_BeforeCellDeactivate(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UGridWeights.BeforeCellDeactivate

 

If Not c_cellBadCell Is Nothing Then

e.Cancel =

True

UGridWeights.ActiveCell = c_cellBadCell

UGridWeights.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode _

,

False _

,

False)

c_cellBadCell =

Nothing

xBadCell =

True

 

End If

 

End Sub

The Validation code:

 

Private Function ValidWeight(ByVal e As Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs) As Boolean

 

Try

 

If e.NewValue = Nothing Then

MessageBox.Show(

"The Weight Class in nothing.", "Weight Class", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

 

ElseIf Not IsNumeric(e.NewValue) Then

MessageBox.Show(

"Please re-enter the Weight Class and be sure it is a numeric entry greater than zero (0).", "Weight Class", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

e.Cancel =

True

 

Return False

 

ElseIf e.NewValue <= 0 Then

MessageBox.Show(

"Please re-enter the Weight Class and be sure it is a numeric entry greater than zero (0).", "Weight Class", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

e.Cancel =

True

 

Return False

 

ElseIf CInt(e.NewValue) > 300 Then

 

If (MessageBox.Show("You have entered an abnormally high Weight Class. Do you want to keep this weight?.", "Weight Class", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = Windows.Forms.DialogResult.No) Then

e.Cancel =

True

 

Return False

 

End If

 

Else

 

Return True

 

End If

 

Catch err As Exception

MessageBox.Show(

"Please be sure your entry is an Interger and that it is a Quantity equal to or greater than 0 (zero) for this item", "Weight Class", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

e.Cancel =

True

 

Return False

 

End Try

 

End Function

Any Help you can is getting this to work would be greatly appreciated.

Thanks

Gary