In my code, I check if the executable file op.exe
is in the application run path directory, in case if not, it does show MsgBox
and exits the application, the problem is that it doesn't really exit the application, because the code after is executing everytime.
Here is the code I'm talking about:
If Not File.Exists("op.exe") Then
MsgBox("op.exe not found!", MsgBoxStyle.Critical, "Error")
Application.Exit()
End If
IO.Directory.CreateDirectory('files')
MsgBox appears, and application does exit, but it's creating the directory files
afterwards (IO.Directory.CreateDirectory('files')
) . I dont want that, and I would like to completely close the application after showing the MsgBox.
How can I do that?
Try Environment.Exit(0)
instead. Application.Exit
causes a message loop to exit, but that happens by the message loop reading a "quit" message from its queue. Environment.Exit
causes the process itself to exit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With