Hey guys,
I have built a form that I want to display from my main form with ShowDialog(). I also added an OK button to the form and set the form property AcceptButton to the OK button control. So, when I display my form and click the OK button, the dialog is closed, and the ShowDialog() method returns DialogResult.OK as expected.
Now, I want to add some code to the Click event of the OK button to verify that certain conditions are met. If those conditions are not met, I want to display a message, and I DON'T want the dialog to close. So, how can I, from the click event method of the OK button, cancel the closing of the dialog? Is this possible at all?
Thanks for any help.
Yarko
I have built a form that I want to display from my main form with ShowDialog(). I also added an OK button to the form and set the form property AcceptButton to the OK button control. So, when I display my form and click the OK button, the dialog is closed, and the ShowDialog() method returns DialogResult.OK as expected.
Now, I want to add some code to the Click event of the OK button to verify that certain conditions are met. If those conditions are not met, I want to display a message, and I DON'T want the dialog to close. So, how can I, from the click event method of the OK button, cancel the closing of the dialog? Is this possible at all?
Thanks for any help.
Yarko