C# - Simple Validation - DialogResult
<p>I have the following code for a button click on a form:</p>

<pre><code>        private void btnOK_Click(object sender, EventArgs e)
        {

        if (this.txtProjectName.Text == "")
        {
            MessageBox.Show("No project name entered", "No Project Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            btnOK.DialogResult = DialogResult.None;
        }
        else
        {
            this.btnOK.DialogResult = DialogResult.OK;
            return;
        }
    }
</code></pre>

<p>If there is something in the text box, the form will only close on the second click.  Is there a way to close the form instantly, and pass a DialogResult.OK to it's caller?</p>

<p>Thanks</p>
