c# - How to close the form after 3 unsuccessful tries? -
i have login form password only. want login form closed if user enters password wrong 3 times.
i declare variable in class body:
int loginattempts = 0;
when login wrong use:
loginattempts++;
in login button enter event use:
private void login_bt_enter(object sender, eventargs e) { if (loginattempts == 3) { login logf = new login(); logf.close(); } }
this not seem working. doing wrong?
you closing logf
instance create , don't show. think need close current form:
login_bt_enter(object sender, eventargs e) { if (loginattempts == 3) close(); // close current form }
Comments
Post a Comment