Validating form close
'Validating' is always firing as expected and the form doesn't close if I set 'e. I am still left pondering, though, how and when the Form1 Validating event is ever called. I would be grateful if someone could post the most trivial of examples where this event fires. I'd still say that the validating event is there to validate a control when it looses the focus.
Cancel' to 'True' in the 'Validating' event handler. Wagner [MVP] I have played around with it a lot and I was not able to repro your problem. Then I could probably begin to understand what makes it tick.
I don't know if this could be classified as a "bug" but it certainly is annoying. The only way I "partially" got it to work was on the validation event of my textbox I called Application. I have a form with one text box, and two buttons: OK and Cancel.
I have the OK button set as the Accept Button and the Cancel button as the ... I click OK and the form closes, without going to the Form1_Validating event. TIA Charles Could someone please explain to me, in words of one syllable or less, how I get the Validating event to fire for a form.
I could validate in the Click event of the OK button, but I can't cancel the form close from there? I have a form with one text box, and two buttons: OK and Cancel.
I have the OK button set as the Accept Button and the Cancel button as the ... I click OK and the form closes, without going to the Form1_Validating event. I know I can cancel the close if I do it in the Closing event.
Private Sub Form1_Closing(By Val _ sender As Object, By Val _ e As System. I have just replied to Cor regarding the failure of the Validating event to fire, which seems to be a more basic problem.
However I thought for that Armin was also the man) :-)) Cor Thanks Cor I have followed Herfried's suggestion and now validate in the button click event.
However, I am still curious why the Validating event does not fire. Charles "Cor Ligthert" Hi Charles, From the other messages I understood that, however the events as lostfocus does also not work, and than when I was busy with that I realized me something what Armin once told to me about focus on a button.
My issue was, I would hit the X button, however, if I was in a text box that caused validation, that was fired first. -CJ "Charles Law" I can do my form validation in the closing event, but I have no immediate way of determining if the user is trying to submit the form or is cancelling it.
I don't know if this could be classified as a "bug" but it certainly is annoying. The only way I "partially" got it to work was on the validation event of my textbox I called Application. It seems to me that this is what the Validating event should be for, but I can't get it to fire.