Rebelling Forms

nooch32

Member
Joined
Oct 25, 2006
Messages
17
Programming Experience
3-5
I have an application and the form frmPhotoOrganiser was set to start up initially, but i wanted to include a login form, so i set up a new form called frmLogin. I also have another form frmSplash, which is a splash screen.

The splash screen was set up as a splash screen in the project properties, and frmLogin was set up in the end to start up first. But once the Login form was displayed the frmPhotoOrganiser loaded up straight after and the frmLogin disappeared. So i set the frmPhotoOrganiser up as the first form and told it to show frmLogin, everything went crazy then too.

I can't understand why it's doing this, there's no code to call any other forms up. I've tried stepping through when the frmLogin was set to load up first and as soon as it finishes the load part of the form the frmPhotoOrganiser form pops up for what seems like no reason.

This must have happend to someone else. I suspect it's some underlying project code that i can't find. Anyone have any ideas?
 
Leave your main form as the startup form. Handle the Startup event of the application and display your login form as a modal dialogue from there. If the login fails you simply set e.Cancel to True and the app will exit gracefully without ever creating a main form. If the login succeeds then do noting and the app will create a main form and proceed normally.
 
You'll have to excuse me i'm new to .net

Set e.cancel = true where?
You're displaying the login form in the Startup event handler.
 
He said "Handle the Startup event of the application.. ". That's where you display login and possibly cancel the start of the application.

To get to the Startup event of the application you go main menu 'Project' click 'Properties', now in 'Application' tab you click the 'View Application Events' button. Select 'MyApplication Events' in left combobox and 'Startup' in right combobox. In the Sub method skeleton that appears you write the single line of code suggested to show login form modally and cancel if login fails.
 
Back
Top