I have a single instance application that will not close with the
following code. It just ignores the close command. Anyone have any
ideas why or what I can do to force the application to close?
testInstances = System.Diagnostics.Process.GetProcessesByName
(processName)
For z As Integer = 1 To 5
If testInstances.Length > 0I Then
For i As Integer = testInstances.Length - 1I
To 0I Step -1
Dim instance As System.Diagnostics.Process
= testInstances(i)
instance.WaitForExit(1000)
instance.Close()
Next
testInstances =
System.Diagnostics.Process.GetProcessesByName(processName)
Else
Exit For
End If
Next