I’ve got Cancel and OK buttons in my form. They both do something and then call close form. How can I make the [x] button on form to call the Cancelclick?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the form is shown modally then you just need to test the value of
ModalResult. A value of mrCancel indicates that the cross was clicked.I would be inclined to arrange that your buttons used their
ModalResultproperties to effect closing of the form. Set the OK button’sModalResulttomrOKand that for the cancel button tomrCancel.