title: Programmatic button click throws 'System.StackOverflowException' exception
body: <p>I have written a WinForms program in C#.Net to click a button programmatically within a password form.</p>
  
  <p><code>Form1</code> loads and shows <code>Form2</code> as a dialogue box.</p>
  
  <p>The application will close if DialogResult is anything other that DialogResult.OK.</p>
  
  <p>So far I have a button click event, which is coded as follows:</p>
  
  <pre><code> if (txtpass.Text == "")
              {
                  MessageBox.Show("You need to enter a password", "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                  txtpass.Focus();
              }
              else
              {
                  if (txtpass.Text == "1234")
                  {
                      radButton1.DialogResult = DialogResult.OK;
                      radButton1.PerformClick();
                  }
                  else
                  {
                      MessageBox.Show("Password Incorrect", "Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                      txtpass.Text = "";
                      txtpass.Focus();
                  }
              }
  </code></pre>
  
  <p>I use <code>radButton1.PerformClick();</code>, but running the program gives me the following message:</p>
  
  <pre><code>An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
  </code></pre>
  
  <p>I'm unsure what is causing this exception to throw.</p>