Reputation: 11147
I have a winform and want to make it unclosable if the user is not logged in ( userLogedIn = false ) and let it close only if the user is logged in ( userLogedIn = true ).
How can i do so ?
Upvotes: 0
Views: 157
Reputation: 1459
You can use the FormClosing event and set e.Cancel to the opposite (!userLoggedIn) of your userLoggedIn value, that will stop the form from closing.
Upvotes: 3