"Stephany Young" <noone@localhostwrote in message
news:e4**************@TK2MSFTNGP05.phx.gbl...
Becaue you are releasing of the mutex way too early.
If you're going to have your Application.Run(...) in a Try/Catch/End Try
block then extend it to include a Finally section and release it there.
I moved the End Using. Is that a good way?
Also, does it make sense to have the two message boxes.
I don't know a lot about the difference between two exceptions.
The revised code is below.
Thanks for the help
Shared Function Main(ByVal cmdArgs() As String) As Integer
Dim mutexWasCreated As Boolean
Using mutx As New Mutex(True, "TestJunk", mutexWasCreated)
If Not mutexWasCreated Then Return 1
Try
Application.EnableVisualStyles()
Application.Run(New FormStudioMdi)
Catch ex As Exception
Utility.WriteStackTrace(ex)
If ex.InnerException IsNot Nothing Then
MessageBox.Show(ex.InnerException.Message, " Experienced An Unhandled Inner
Error And Must Exit", MessageBoxButtons.OK)
If ex.GetBaseException IsNot Nothing Then
MessageBox.Show(ex.GetBaseException.Message, " Experienced A BaseException
And Must Exit", MessageBoxButtons.OK)
Return 1
End Try
Return 0
End Using
End Function