c# - Custom password Winform -


I am working on a C # Winform application and I have a button that asks for password Clicks. If the password is correct then the code is executed under the button. Here is the code of the main form. pass password = new password (); Pass.ShowDialog (); If (pass.Dialograschult == DialogResult.OK) {if (pass.password == "12") {

and below is the code that I have on the OK button in the form < / P>

  Private Zero btnOK_Click (Object Sender, EventArgs e) {button1.DialogResult = DialogResult.OK; }   

The problem is that the correct form of the password form is clicked twice and is working. Any ideas why?

I see that the property defines that the DialogRellet Is clicked This means that you must have a code line button1.DialogResult = DialogResult.OK; Set in designer instead of clickstory, or in the constructor

Comments