Environment.Exit Method terminates this process and gives the underlying operating system the specified exit code.
Imports System Module ExitTest Sub Main() Environment.Exit(2) End Sub End Module