How to identify link label is clicked in my form closing event in c#? -


i have logout button link label on main form if user click logout link label yes logout successfully.

but problem is closed directly main form without clicking logout
link label. there no way write when user logout in log file because didn't click logout link label.

so want identify logout link label in form_closing event?

how can i?

edit :

under logout link label:

 stopwatch = applicationstate.currenttime.stopwatch;  stopwatch.stop();   var timespent = stopwatch.elapsed.tostring();   application.exit(); 

thanks.

you can handle situation in 2 ways:

  1. remove form's border user can not close directly (but in 1 have write code allow user move form).

    this.formborderstyle = system.windows.forms.formborderstyle.none; 
  2. call logout method or event handler on form_closing

but should have separate method of containing complete logic of logout rather event handler containing it.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -