The code to tell if the cancel button has been clicked is: /////// Public Declare Function Window From Point Lib "user32" (By Val p As POINTAPI) As Int Ptr Public Structure POINTAPI Dim X As Integer Dim Y As Integer End Structure Private Function Cancel Button Clicked() As Boolean Dim p As New POINTAPI p.As far as the original validation issue, I started a new project (VB2005) and tried your approach It works except that pressing the Esc key still causes the validation event to fire.

Have fun, be honest and think about what makes you unique and interesting and make your photos count.2.Why it would stop on a textbox with tabstop property set to False - I have no idea, unless it is a behavior of the container its in.If I hit the escape, the validation event fires and since the m Canceling is not True, the validation error gets displayed before the form closes.The form's Key Preview is set to True so that I can handle key events on the form...If I connect a gun type, the program fails and the cursor jumps to a text box that has it's Tab Stop property set to False.My final solution, unless someone has a better suggestion, is to change the Validating event to the Leave event and detecting whether the cancel button had been clicked in the Leave event and exiting if it was.

You must have an account to comment. Please register or login here!