Vb net cancel validating event

But, it seems that the load event can not be canceled. If You Not Happy Then me.close Else 'do your thing in the form End If John Warner" id="ctl00_m_m_i_ctl00_gr_ctl01_bestanswerbody" class="textarea-bestanswerhidden" name="bestanswerbody" answerbody Id="823936" / LOL!

I know I can move the file validation code to the MDI parent and just avoid loading the child form if necessary, but I prefer to keep all of the code for one particular procedure within the child form. I wish it was that simple, but it seems that I can't call me.close until after the form load event finishes.

I could validate in the Click event of the OK button, but I can't cancel the form close from there? Private Sub Form1_Closing(By Val _ sender As Object, By Val _ e As System. 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" 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 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.

To validate the editor contents, check the value contained in the Editor. If the value is invalid for the cell, set the Cancel parameter to true and the grid will remain in edit mode until the user types a valid entry.

Could someone please explain to me, in words of one syllable or less, how I get the Validating event to fire for a form.

If the document is not valid or if it is open in another app, I want to cancel the form load event of the MDI child.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.I could validate in the Click event of the OK button, but I can't cancel the form close from there? What I cannot do is get the Validating event to fire at all.If I put a close event anywhere in the form load event, I get a: Additional information: Cannot call Close() while doing Create Handle(). So, what I need to do is actually cancel the load event.Otherwise, I have to move the close event outside of the load event and that means if there's a problem with the file, the form will open, then immediately close.

Leave a Reply