When form A is modal and it displays a second modal form B, and the modal result for B is set and B then closes, A is also closed.
How can this be prevented?
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.
This is not true, there has to be some other problem in your code. Setting
ModalResultwill affect only the currently modal form. Try this very simple example:Create a new form
Drop a button onto it
In the button
OnClickevent handler add this code:You will observe that each button press creates a new modal form, and you can repeat this as often as you wish. Closing a form will set its
ModalResulttomrCanceland re-enable the parent form. To exit the application you will need to close all forms, one by one, in the opposite order of creation.