From 3caa1cd036b46166ed92bf20bd6899c34b41c51b Mon Sep 17 00:00:00 2001 From: Karl Date: Tue, 9 Oct 2018 13:21:31 +1300 Subject: [PATCH] Call Application.Run passing ApplicationContext, not MainForm Passing MainForm prevents WindowsFormsApplicationBase.ShutdownStyle from having any effect. It will always shut down when MainForm closes. This fixes that by passing the WindowsFormsApplicationContext, which handles OnMainFormClosed in a way that supports ShutdownStyle. --- .../WindowsFormsApplicationBase.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.ApplicationServices/WindowsFormsApplicationBase.vb b/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.ApplicationServices/WindowsFormsApplicationBase.vb index 6a533073..f74363ff 100644 --- a/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.ApplicationServices/WindowsFormsApplicationBase.vb +++ b/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic.ApplicationServices/WindowsFormsApplicationBase.vb @@ -193,7 +193,7 @@ Namespace Microsoft.VisualBasic.ApplicationServices End If End If - Application.Run(MainForm) + Application.Run(ApplicationContext) End Sub _