﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the textbox?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 14:38:15 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the textbox?</title><link>http://forum.strataframe.net/FindPost32226.aspx</link><description>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?</description><pubDate>Tue, 15 Oct 2013 22:53:34 GMT</pubDate><dc:creator>Ross L Rooker, Sr.(1)</dc:creator></item><item><title>RE: How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the textbox?</title><link>http://forum.strataframe.net/FindPost32228.aspx</link><description>Hi Ross,&lt;br/&gt;&lt;br/&gt;Don't know if this would work because I have not tried, but here it goes anyway....&lt;br/&gt;&lt;br/&gt;&lt;ol&gt;&lt;li&gt;Create a Private variable in your form, something like Private _FormIsClosing as Boolean = False&lt;/li&gt;&lt;li&gt;In the FormClosing() event, set _FormIsClosing = True&lt;/li&gt;&lt;li&gt;Move your validation code to the &lt;span id="ctl00_ctlContentPlaceHolder_ctl00_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl02_lblFullMessage"&gt;UltraMaskedEdit.AfterExitEditMode() instead of the &lt;/span&gt;&lt;span id="ctl00_ctlContentPlaceHolder_ctl00_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl02_lblFullMessage"&gt;UltraMaskedEdit.Leave() because the Leave() event will not fired after the FormClosing() event&lt;br/&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;In the &lt;span id="ctl00_ctlContentPlaceHolder_ctl00_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl02_lblFullMessage"&gt;UltraMaskedEdit.AfterExitEditMode() event test for &lt;/span&gt;_FormIsClosing = True as part of your validation.&lt;/li&gt;&lt;/ol&gt;Hope this work for you!!!</description><pubDate>Tue, 15 Oct 2013 22:53:34 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How do I bypass the validation if the user clicks to CLOSE the form while the cursor is in the textbox?</title><link>http://forum.strataframe.net/FindPost32227.aspx</link><description>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. &amp;nbsp;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. &amp;nbsp;When the leave event fires, can you obtain the reference to the control that has the next focus? &amp;nbsp;If so, then you might be able to detect whether the chrome has focus and the form is closing. &amp;nbsp;</description><pubDate>Tue, 15 Oct 2013 15:07:32 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>