Last active
January 22, 2017 05:30
-
-
Save TechNinjaWeb/b2850d0cc6637a5289bfffc9d22c7832 to your computer and use it in GitHub Desktop.
Handling event detection and intent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private LastActiveControl As Control = Me ' initialize on form creation | |
Protected Overrides Sub UpdateDefaultButton() | |
' Just added a IsNot condition to clarity | |
If (LastActiveControl Is txtNumberOfDrinks) AndAlso | |
((ActiveControl Is btnClear) OrElse (ActiveControl Is btnExit)) Then | |
' Only problem is that it tries to validate twice upon tabbing away (only once on click) | |
ElseIf (LastActiveControl Is txtNumberOfDrinks) AndAlso | |
((ActiveControl IsNot btnClear) OrElse (ActiveControl IsNot btnExit)) Then | |
validateForm() | |
End If | |
LastActiveControl = ActiveControl ' Store this for the next time Focus changes | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment