Developer, Former MVP, now at Microsoft - Best of 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
namespace WindowsApplicationCSusingVB{ public class MyApplication : System.Windows.Forms.WindowsFormsApplicationBase{ public MyApplication(): base(System.Windows.Forms.AuthenticationMode.Windows){ base.NetworkAvailabilityChanged += new Microsoft.VisualBasic.MyServices.NetworkAvailableEventHandler (this.MyApplication_NetworkAvailabilityChanged); base.Shutdown += new System.Windows.Forms.ShutdownEventHandler (this.MyApplication_Shutdown); base.UnhandledException += new System.Windows.Forms.UnhandledExceptionEventHandler (this.MyApplication_UnhandledException); base.Startup += new System.Windows.Forms.StartupEventHandler (this.MyApplication_Startup); this.IsSingleInstance = false; this.EnableVisualStyles = true; this.ShutdownStyle = System.Windows.Forms.ShutdownMode.AfterMainFormCloses; } protected override void OnCreateMainForm(){ this.MainForm = new Form1(); } protected override void OnCreateSplashScreen(){ this.SplashScreen = new Form2(); } private void MyApplication_NetworkAvailabilityChanged(object sender, Microsoft.VisualBasic.MyServices.NetworkAvailableEventArgs e){ System.Windows.Forms.MessageBox.Show("network"); } private void MyApplication_Shutdown(object sender, System.EventArgs e){ System.Windows.Forms.MessageBox.Show("shutdown"); } private void MyApplication_Startup(object sender, System.Windows.Forms.StartupEventArgs e){ System.Windows.Forms.MessageBox.Show("startup"); } private void MyApplication_UnhandledException(object sender, System.Windows.Forms.UnhandledExceptionEventArgs e){ System.Windows.Forms.MessageBox.Show( e.Exception.StackTrace, e.Exception.Message); e.ExitApplication = false; } internal static void Main(string[] Args){ (new MyApplication()).Run(); } } //end class } //end namespace