Using Windows Forms I would like to have a small login screen the user authorizes himself/herself through (say its Form1), so the main application (say its Form2) would be opened after login. But I suppose when I use Application.Run(Form1), after closing it the whole application closes.
Isn't there any other way except using invisible Form2? Something like run Form2 on demand and close originally ran Form1? Hope it makes sense to you :)
The Main method calls Application. Run(context) to start the application given the ApplicationContext.
Click the File tab, and then under Help, click Options. Click Current Database. Under Application Options, in the Display Form list, select the form that you want to display when the database starts. Click OK, and then close and reopen the database to display the startup form.
" This feature is already built in to Windows Forms. Just go to the project properties and click the "Single Instance Application" checkbox. "
Create an overload of System.Windows.Forms.ApplicationContext
, create Form1
first and then Form2
in its constructor.
Use Application.Run
overload that accepts ApplicationContext
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With