title: Killing processes in vb.net
body: <p>What I am actually trying to do is kill all common Processes. EX: chrome, firefox etc.</p>
  
  <p>What I am looking forward to do is to : ' Kill all processes EXCEPT  [needed ones ' ".
  I want to replace it with this bit of code here.</p>
  
  <pre><code> Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      Button1.Enabled = False
      Label3.ForeColor = Color.Green
      Timer1.Start()
  
      If ProgressBar1.Value = 100 Then
          MessageBox.Show("Done", "Kill Successfull")
      End If
  
  End Sub
  
  
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Button1.Enabled = True
      Label3.ForeColor = Color.Red
      Timer2.Stop()
      ProgressBar1.Value = 0
  End Sub
  
  Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
      For Each prog As Process In Process.GetProcesses
          Timer2.Start()
          ProgressBar1.Increment(30)
          If prog.ProcessName = "chrome" Then
              prog.Kill()
          End If
          If prog.ProcessName = "notepad" Then
              prog.Kill()
          End If
          If prog.ProcessName = "firefox" Then
              prog.Kill()
          End If
          If prog.ProcessName = "codeblocks" Then
              prog.Kill()
          End If
          If prog.ProcessName = "cmd" Then
              prog.Kill()
          End If
          If prog.ProcessName = "PhotoshopCS6" Then
              prog.Kill()
          End If
          If prog.ProcessName = "uTorrent" Then
              prog.Kill()
          End If
          If prog.ProcessName = "ccleaner" Then
              prog.Kill()
          End If
          If prog.ProcessName = "notepad++" Then
              prog.Kill()
          End If
          If prog.ProcessName = "lightshot" Then
              prog.Kill()
          End If
          If prog.ProcessName = "ccleaner" Then
              prog.Kill()
          End If
      Next
  End Sub
  </code></pre>