MDI form startup
Hi
I last used .Net 2002 and in the MDI form used the code below. In the properties of the project you set the compiler to start the main() function first.
Where in .Net 2005 do you set this property(i.e. if it's stil there...).
I need the app to start my Login form first. Any ideas?
| |
<System.STAThread()> _ PublicSharedSub Main() startMyApplication() EndSub PrivateSharedSub startMyApplication() 'Login Dim frm1 As New frmLogin() If frm1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then System.Windows.Forms.Application.Run(New frmMDI()) Else System.Windows.Forms.Application.Exit() End If End Sub
|
[1199 byte] By [
styvie] at [2007-12-16]
I did specify frmMDI as startup form, but the application did not start on my own defined Sub Main() in frmMDI. I did however uncheck the 'Enable application framework' checkbox. This did the trick, but I'm not sure if this is the right way to do it...
You lose support for detecting multiple instances of your application, automatically saved settings, and a few other things.
You could actually move your code into the Startup event of the ApplicationEvents.vb file (via the Project Properties -> View Application Events) and cancel the event if the user cancels the dialog.