How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the...


How do I bypass the validation if the user clicks to CLOSE the form...
Author
Message
Ross L Rooker, Sr.(1)
Ross L Rooker, Sr.(1)
StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)
Group: StrataFrame Users
Posts: 50, Visits: 163
MicroFour.StrataFrame.UI.Windows.Forms.Infragistics.UltraMaskedEdit textbox with validation code in the LEAVE event. How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the textbox?
StrataFrame Team
S
StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)StrataFrame Developer (3.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
If the Leave event fires before the Closing event of the form, then I'm not sure there is a clean way to do it.  I could see doing your validation on a timer and when the Closing event fires, it cancels the timer if it's started, but that would be kind of jicky.  When the leave event fires, can you obtain the reference to the control that has the next focus?  If so, then you might be able to detect whether the chrome has focus and the form is closing.  
Edhy Rijo
E
StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)StrataFrame VIP (3.8K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Ross,

Don't know if this would work because I have not tried, but here it goes anyway....

  1. Create a Private variable in your form, something like Private _FormIsClosing as Boolean = False
  2. In the FormClosing() event, set _FormIsClosing = True
  3. Move your validation code to the UltraMaskedEdit.AfterExitEditMode() instead of the UltraMaskedEdit.Leave() because the Leave() event will not fired after the FormClosing() event
  4. In the UltraMaskedEdit.AfterExitEditMode() event test for _FormIsClosing = True as part of your validation.
Hope this work for you!!!

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search