Public Sub Quit_PI_Session() Dim frmCollection As System.Windows.Forms.FormCollection Dim frm As System.Windows.Forms.Form Dim countFrm As Integer Dim frmArr(2) As Object Dim frmName As String On Error GoTo ErrorHandler 'Reset global session variables dblFrameLength = 0 dblFrameWidth = 0 intRollNumber = 0 intVRollNumber = 0 intRRollNumber = 0 intLRollNumber = 0 intFrameNumber = 0 intMethodListIndex = 0 intPhotoIndexListIndex = 0 intUnitsListIndex = 0 intNewFramesCheckboxCounter = 0 intFramesShapefileNamesCounter = 0 strPhotoIndexShapefileName = "" strFramesShapefileName = "" 'End the current session 'Unload frmMethods 'Unload(frmRollFrame)'vb6 'Unload(frmRollFrameControls)'vb6 'Unload(frmPhotoIndex) 'vb6 frmCollection = System.Windows.Forms.Application.OpenForms countFrm = frmCollection.Count - 1 For value As Integer = 0 To countFrm frmArr(value) = frmCollection.Item(value) Next For value As Integer = 0 To frmArr.Length - 1 'frmArr(value).Hide() 'frmArr(value).Close() 'frmArr(value).Dispose() Next myFrmFrameFootPrinter.Close() myFrmRollFrame.Close() myFrmRollFrameControls.Close() myFrmFrameFootPrinter = New frmFrameFootPrinter myFrmRollFrame = New frmRollFrame myFrmRollFrameControls = New frmRollFrameControls myFrmRollFrameControls = Nothing 'myFrmFrameFootPrinter.Dispose() 'myFrmRollFrame.Dispose() 'myFrmRollFrameControls.Dispose() Debug.Print("Closed all forms") Exit Sub 'This message just happens when you move the mouse over and over again if this is enabled 'Public Overrides Sub OnMouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer) ''.NET deactivate tool 'If myFrmFrameFootPrinter.Visible = False Then ' MsgBox("MyBase Deactivate") 'MyBase.Deactivate() 'MyBase.m_enabled = False 'End If End Sub Private Sub cmdEndSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdEndSession.Click 'Reset global variables and Quit Photo Index Frame processing Call Quit_PI_Session() ESRI.ArcGIS.ADF.COMSupport.AOUninitialize.Shutdown() 'MyBase.m_deactivate = True 'MyBase.Close() ' MyBase.Activate() 'MyBase.ResetMouseEventArgs() 'Application.Exit() 'Close() 'Environment.Exit(0) 'createPhotoFrames.Exit() 'm_application.Visible = False ' The user wants to exit the application. Close everything down. 'Application.Exit() End Sub
Solved! Go to Solution.