Validating form close
I think the Validating /event/ for a form doesn't make sense. I have now implemented the solution by using the OK_Click event in much the way you suggest. I probably won't use it now for my current situation, but I am assuming that it should fire at some point, and when it does I think I would like to be there.
A control is validated when the Container is a Container Control. 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.
'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.
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.
Charles "Cor Ligthert" Hi Charles, Is this not where you looking for? I think my problem is more fundamental than that though.
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.
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.
You're saying the the Validating event of the Form fires? 'Validating' is always firing as expected and the form doesn't close if I set 'e. *** Sent via Developersdex Don't just participate in USENET..rewarded for it!