Hey, I am trying to make a simulation of a button click for a password form, basically the form1 loads and shows form2 as a dialogue, and if it does not give back DialogResult.OK, then it closes the application.
So far I have in the button:
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();
}
}
So far as you can see I am trying to use radButton1.PerformClick();
but that gives me the error message:
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
Any ideas?
Thanks.