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]
# 1
This is for VB Express but I'd guess VS would be the same: project properties, Application tab, Startup form.
jmcilhinney at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

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...

styvie at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3

You are right, you will need to disable the Enable application framework to use a custom defined Main.

DavidM.Kean at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
What am I losing out on if I disable the 'Enable application framework'?
styvie at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5
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.

DavidM.Kean at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...