Vb net validating

I know it doesn't address the problem of the missing click event, butperhaps you can solve your problem by modifying your approach.

In a similar case when I wanted the user to validate or cancelclosing/saving, I have used the Form's Closing event for this purpose.(Well actually, since it was a base for several derived forms, I overrodethe On Closing method.) The main problem with this approach is that it isstill necessary to invoke the Validation code for the currently Active Control.

Hi, It appears displaying a messagebox in a validating event will cancel the subsequent event. My understanding is that the second button's event should fire unless you set the cancel arg to true in the validation event handler. Run(frm) End Sub Private Sub Btn Validating(By Val sender As Object, By Val e As System. If you run the program, button 1 will start with the focus.

In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's validating event. Thanks Al Imports system Imports system.windows.forms ' Create a form, add two buttons and event handlers. Validating, Address Of Btn Validating btn = New Button btn. It appears displaying a messagebox in a validating event will cancel thesubsequent event. If you run the program, button 1 will start with the focus. If you click on button 2, the button 1 validating event will fire and the program will display the messagebox.

(I think it should be possible to locate and call the handler in a generic fashion, and I'm still hoping to figure out how to do this.) Cheers, Randy Al Santino wrote: Yes, if you remove the Message Box things work fine.

But I'd like to use this in the case where someone enters fills in some controls on a form and then chooses to close the form.

vb net validating-16

If you remove the Message Box call in the validation handler the click event fires for button 2. Show("Btn Validating event") End Sub Private Sub Btn Click(By Val sender As Object, By Val e As System. Show("Btn Click event") End Sub End Module Or better put: Yes.

I haven't yet found a good generic way to do this (in VB),and so have had to add code to each derived form to find the activecontrol and directly call its validation handler.

(I think it should bepossible to locate and call the handler in a generic fashion, and I'mstill hoping to figure out how to do this.)Cheers, Randy Al Santino wrote: Yes, if you remove the Message Box things work fine.

In the program below, button 2's click event doesn'tfireif you open a dialog box in button 1's validating event. Well, I thought it would fire because that was how it's supposed to work.

Run(frm) End Sub Private Sub Btn Validating(By Val sender As Object, By Val e As System. In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's validating event. It appears displaying a messagebox in a validating event will cancel thesubsequent event.

Leave a Reply