I use C#. I have a Windows Form with an edit box and a Cancel button. The edit box has code in validating event. The code is executed every time the edit box loses focus. Wh
Create a bool:
bool doOnce;
Set it to false in your function and then:
if (doOnce == false) { e.cancel = true; doOnce = true; }
This means it will only run once and you should be able to cancel it. This worked for me anyways.