VB. NET is minimized when the form is closed (the problem that the. Net Program causes XP to fail to shut down and restart)

Source: Internet
Author: User

We often need to implement the "user closes the form, but the form is not closed but minimized" function. The implementation of this function is very simple, you only need to write the following in the formclosing eventCodeYou can:

If E. closereason = closereason. userclosing then 'is used to determine whether the form is closed by the user.

E. Cancel = true'ProgramStop closing

End if

The "if E. closereason = closereason. userclosing then" clause is used to determine whether the form is closed by the user.

Why is this judgment necessary? There are three sources for the "close form" Operation: User, other programs, and Windows system, such as shutdown and restart, in Windows, the program opened by the user is closed.If this condition is not added, the windows program cannot be closed before it is shut down and restarted, so the Windows system is stuck when it is shut down and restarted. Therefore, XP cannot be restarted after it is shut down (XP and win7 are unavailable ).

Thank you, a friend named Chen Feng, for proposing the bug "convenient master Quick Start tool" to me. After research, this problem has been resolved as mentioned above.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.