DialogResult

G

Guest

Something tells me that there is a single-method way of accomplishing this. When you click the button that is designated as the cancel button, the form automatically acts as if it has been dismissed, but for the OK, you have to put in its click handler:

private void btnOK_Click(object sender, System.EventArgs e)
{
DialogResult = DialogResult.OK;
Hide();
}

Is there a better way of doing it?
 
J

John Wood

Did you set the DialogResult property of the button? And set the
AcceptButton property of the form to point to the OK button?

--
John Wood
EMail: first name, dot, last name, at priorganize.com
Beeeeeeeeeeeeves said:
Something tells me that there is a single-method way of accomplishing
this. When you click the button that is designated as the cancel button, the
form automatically acts as if it has been dismissed, but for the OK, you
have to put in its click handler:
 

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