Avoid validation on cancel

B

Boni

Dear all,

I simple question is driving me crazy.

following lost focus of a Textbox must work all time except, when focus is
lost because a cancel button is pressed.

How can I do that?

Thanks a lot,

Boni

Private SubXX_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
Handles XX.LostFocus

If Not IsValid(XX.Text) Then

MsgBox.show("XXX"...)

End If

End Sub
 
V

vishal

Why don't u try validating event???
Read the acceptbutton, acceptsreturn and cancelbutton properties of the
form and textbox and use them in ur application...
 
B

Boni

Thanks. The thing with "validating event" and error provider worked.. But
cancel still don't close the form. Could you explain
"Read cancelbutton properties".
Which property would be set if cancel button was pressed?
 
B

Boni

Thanks you very much. It worked, but I have absolutely the same problem. If
I set e.cancel =true then cancel button click is ignored.How do I "Read the
cancelbutton properties"? Which property of a cancelbutton should I
evaluate in order to know that it was pressed?
 

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