c# - A little bug in my Login system -


I have a little problem with my simple login system

  Fixed class program {{STAThread} static zero main () {Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (wrong); Bull Login Successful; Bull login retrieval; (Login login = new login ()) using {loginSuccessful = (login.ShowDialog () == DialogResult.OK); LoginRetry = (login.ShowDialog () == DialogResult.Retry); If (log in full) {application.Run (new form 1 ()); } If loginRetry {application.Run (new login ()); }}}}  

This works but a small problem begins with these two lines:

  loginSuccessful = (login.ShowDialog () == DialogResult.OK); LoginRetry = (login.ShowDialog () == DialogResult.Retry);  

The program reaches 'login-in-fail-line' in frames, but when it reaches the next line, then Windows applications start moving forward from its position and the login button But waits for a new click before it decides to shut itself down and go to the application of the next form or to stay in place due to an incorrect usercode / password combination.

How can I fix this? Btw It is .net, C # I do not want to move the form 1 position from left to right and do not ask for a new click action.

A better approach would be using the form clipping event in the log-in dialog, and if the dialog report DialogRilt OK and user can not be authenticated, so e. Cancel Set the property to true, in this way you do not have to do this. By creating new examples of login dialog, neither has to call ShadowIoga twice when it is closed.

Login dialog:

  Private zero login_formClosing (Object Sender, FormClosingEventArgs e) {if (This.DialogResult == DialogResult.OK) {// Certified user // If e.Cancel = true fails to specify; To close the dialog for login}}  

main body:

 using  (login login = new login ()) {if ( Login.ShowDialog () == DialogResult.OK) {application.Run (new form 1 ()); }}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -