Methods in C # show. and ShowDialog Use difference

Source: Internet
Author: User

Show () is a non-modal form.
ShowDialog () is a modal form.

If this time with show, then the thing that happens is that when the subform is opened, the main form is displayed, and when you use ShowDialog (), the main form is displayed when the subform is closed.
We can turn the Show method into a ShowDialog method, as the name implies, ShowDialog is a way to bind the Show method, he is not free to switch, in other words, when you do not close your current page under the premise, you can not close the page after any page, It is the only current (path open) to True.
Because the Show method is not bound, the various windows and dialog boxes that it displays can be toggled with each other without having to close the current window or dialog box. But because he is not bound, the order of each window opened by the Show method is non-fixed, and the order of the windows opened by the Show method may change greatly if you encounter any problems!


The difference is that forms that are opened in ShowDialog () are not allowed to manipulate other forms until the form is closed. Show () is not subject to this limitation
For example, if you open the subform first, you want to hide the main form.
If this time with show, then the thing that happens is that when the subform is opened, the main form is displayed, and when you use ShowDialog (), the main form is displayed when the subform is closed.

Methods in C # show. and ShowDialog Use difference

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.