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.