VB Customization Calculate on LostFocus behavior


(Chris Simpson) #1

Hi all,

So I have a form based on a UD table. I have 6 NumericEditor fields and a Total NumericEditor field. I am simply just trying to run a ComputeTotal function anytime the cursor leaves any one of the 6 fields. Strangely, it only runs when I leave the field and then give focus back to it…

Me.edtParts = CType(csm.GetNativeControlReference(“a1aa967d-7450-4d4d-83df-930abf6c3f54”), Epicor.Mfg.UI.FrameWork.EpiNumericEditor)
AddHandler Me.edtParts.LostFocus, AddressOf Me.edtParts_LostFocus

Private Sub edtParts_LostFocus(ByVal sender As Object, ByVal args As System.EventArgs)
Call ComputeTotal
End Sub

Any help would be appreciated.

(Jose C Gomez) #2

Use the Validating Event.

(Chris Simpson) #3

@josecgomez, could you explain a bit or give an example? I’m not a wiz at VB…


(Jose C Gomez) #4

Instead of using the Lost_Focus event use the Validating Event on your control.

(Chris Simpson) #5

Seems better but another strange behavior is that it computed immediately when I tabbed out of the field but not when I mouse clicked out of the field. I did compute when I mouse clicked back into the field.

(Jose C Gomez) #6

When you mouse click out of the field validating should still fire.

(Chris Simpson) #7

Sorry. I get this after changing LostFocus to Validating

Error: BC30408 - line 64 (3004) - Method ‘Private Sub edtParts_Validating(sender As Object, args As System.EventArgs)’ does not have the same signature as delegate ‘Delegate Sub CancelEventHandler(sender As Object, e As System.ComponentModel.CancelEventArgs)’.