c# - How to know if user clicked on X in the form -


this question has answer here:

thanks takes effort on answering question.

i'm using winforms c#, , on mainform_load, i'm calling login form user. login form contains x button (the default button on top-right) , loginbutton.

now...

if user decides click on x button login form closes , should mainform, know how do. but... if user clicks on loginbutton loginform should close, mainform should stay opened.

any idea hwo ?

assuming using showdialog show login form, can this:

if(loginform.showdialog() == dialogresult.ok) {    //login ok } 

your login form should set dialogresult ok before closes, successful login, so:

if(loginsuccess){     this.dialogresult = dialogresult.ok;//this close form } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -