开发者

don't close form except a user is logged in

I have a winform and want to make it unclo开发者_Go百科sable 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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜