C # form switching in Windows Programming

Source: Internet
Author: User

We are writing a C/S architecture for WindowsProgramSwitch between the logon form and the main form is involved. The following is the design based on different ideas:

Assume that login is the logon form and main is the main form.

If we are in program. if the main function in CS is set to login as startup, that is, the logon form is set as the main form, so that the main form cannot be opened using the main function, if you use it to open the message, the error "starting another message loop on a single thread is invalid" is returned. To first start the login form, you can design the following in the main function:

The main function is in program. CS.

    Application. enablevisualstyles ();
    Application. setcompatibletextrenderiNgdefault (false );
    Login Login = New Login ();
    If (login. showdialog () = dialogresult. OK)
    {
         Application. Run (New Main ());
    }

    In the login logon form logon button event, set:

    This. dialogresult = dialogresult. OK; // set the dialog box result of the form.

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.