So I thought I'd look around some just to learn more about Classes I never use.
Some of the following code doesn't work, can anyone educate me as to why not? I'm quite certain that I'm showing some level of ignorance here...![]()
Code:Imports Microsoft.VisualBasic.ApplicationServices Public Class Form1 Dim WithEvents wab As WindowsFormsApplicationBase = New WindowsFormsApplicationBase #Region " Try to use the Shutdown Event " Private Sub wab_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles wab.Shutdown MessageBox.Show("Shut Down -- This Never Happens") End Sub #End Region #Region " Try to use the Startup Event " Private Sub wab_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles wab.Startup MessageBox.Show("Starting Up -- This Never Happens") End Sub #End Region #Region " Don't handle an exception and see if the UnhandledException Event can be used. " 'Force an error from within the Button1.Click Event Below Private Sub wab_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles wab.UnhandledException MessageBox.Show("UnhandledException This Doesn't Ever Show") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Try 'Cause Overflow Dim x As Integer = 999999999 x *= 10 'Catch ex As Exception 'MessageBox.Show("Caught") 'End Try End Sub #End Region Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Show that wab actually points to an object MessageBox.Show(wab.OpenForms.Count.ToString) End Sub End Class
How is the WindowsFormsApplicationBase class supposed to be used?




Reply With Quote