stop dialog from closing

  • Thread starter Thread starter SteveK
  • Start date Start date
S

SteveK

Hi-

I have created a basic login form. If the user enters invalid credentials,
I want to display an error. However, when the user presses the Login
button, the dialog closes... I'm sure this is normal, but how can I interupt
this and keep the dialog alive until I am ready for it to close?

Thanks,
Steve
 
Steve,

Are you calling the Close method on the form when you press the button?
The dialog doesn't just close by itself. Can you post the code?
 
Hello SteveK,

If you have set the login button as the accept button for your dialog it will close automatically. If this is the case then you in your Login button click event handler if you detect an error you can set the DialogResult = DialogResult.None that way it should not close the dialog.

HTH
Wes Haggard
http://weblogs.asp.net/whaggard/
 
Hi Steve,

You might want to trap the form's closing event. Set e.Cancel = true to
cancel the form from being dismissed.

So, when the user presses a button, do the authentication and store the
results using a flag that you can check in the closing event handler to
decide if the form can be closed.

HTH,
-Azhagan
 
perfect!

Thank you all!


Wes said:
Hello SteveK,

If you have set the login button as the accept button for your dialog it
will close automatically. If this is the case then you in your Login button
click event handler if you detect an error you can set the DialogResult =
DialogResult.None that way it should not close the dialog.
 
Back
Top