Kill a Process

By KuTsuM on Sep 26, 2007

This snippet will kill a current running process in VB.NET. To load snippet go File>New Project>Console Application

Module procKill
    Sub main()
        System.Console.Writeline("What process would you like to kill (IE: notepad)")
        Dim kProc = System.Console.Readline()
        Dim pList() As System.Diagnostics.Process = _
        For Each proc As System.Diagnostics.Process In pList
            Dim resp As MsgBoxResult
            resp = MsgBox("Terminate " & proc.ProcessName & "?", _
                MsgBoxStyle.YesNo, "Terminate?")
            If resp = MsgBoxResult.Yes Then
            End If
    End Sub
End Module


Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.