Ignoring Validation Events

C

CJ Taylor

Another quesiton,

I have a form, with a control on it that has a handler for control.validated
event.

Now, if that control has focus, and I click the close button the validation
event fires..

So I think to myself, how to tell this, so I add a private property on the
form called IsClosing, which is set by the Form.Closing event...

However, validated seems to fire before the closing event, negating the
whole purpose... anyone have a workaround/solution to this?

Thanks,
CJ
 
C

Cor

Hi CJ,

I did not know anymore if this has to be true or false,
I tried it on that dialogform from you, it did gave also for me strange
behaviour because there it was not necessary to do this.

Private Sub Form2_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = False
End Sub

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor said:
I did not know anymore if this has to be true or false,
I tried it on that dialogform from you, it did gave also for me strange
behaviour because there it was not necessary to do this.

Private Sub Form2_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = False
End Sub

.... nevertheless, validation will be done before the event fires,
doesn't it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top