This code shows how to start an application without displaying a startup form using the application framework in VB 2005

This is pretty cool and makes your startup code more flexible.


Steps for generating this in VB 2.0

a. Create new VB windows forms application
b. Select Project->Add Module menu item
Name the Module "Program.vb" (the name doesnt actually matter)
c. Open up "Program.vb" in the code editor
d. Add the following lines

Code
<STAThread()> Sub Main()
MessageBox.Show("Now calling main!")
Application.Run(new Form1)
End Sub


e. In the solution explorer, double click on My Project
f. Uncheck the "Enable Application Framework" checkbox
g. Change the Startup object to "Sub Main"

h. Save and run the app. Verify you see "Now calling main!" messagebox.

i. Now we've got a main, you can write your own application context and replace the code in Sub Main to use your own Application Context.

Code
<STAThread()> Sub Main()
Dim applicationContext As MyApplicationContext
applicationContext = New MyApplicationContext()

Application.Run(applicationContext)
End Sub


Code
Class MyApplicationContext
Inherits System.Windows.Forms.ApplicationContext

' To be implemented...

End Class 


Source:
http://blogs.msdn.com/jfoscoding/archive/2005/08/24/455579.aspx


The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)