C #. NET Hidden Forms

Source: Internet
Author: User

Hide the form, open the form and if you want it to be hidden, and then show it, you can tell if it's null or not, or if it's closed, or new, or show it.

Of course, if there are hidden words to quit when it is best to use Application.exit () to close the program.

        Form fh;         Private void button6_click (object  sender, EventArgs e)        {            ifnull | | FH. isdisposed)            {                new  Form9 ();                 = F9;                F9. Show ();            }             Else             {                fh. Show ();            }   

Another situation is to hide the parent form when the subform is opened, to show the parent form when the subform is closed, to use someone else's code, I don't have a test, it should mean the same thing.

Using the modal dialog box ShowDialog open Form B, when form B is closed, it is necessary to return a DialogResult, default to None, similar to OpenFileDialog and SaveFileDialog in the button click event of form a
private void Form2_formclosing (object sender, FormClosingEventArgs e) {     
This. Close (); This. DialogResult = DialogResult.OK;

  

C #. NET Hidden Forms

Related Article

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.