Process Start colse kill

VNote 2017.07.08 09:55:23 *: Imports System.Diagnostics
Public Class Form1

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Process.Start("notepad.exe")
End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
' 모두 종료
Do Until Process.GetProcessesByName("notepad").Count < 1
For Each p As Process In Process.GetProcessesByName("notepad")
p.CloseMainWindow()
Next
Loop
End Sub

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
For Each p As Process In Process.GetProcessesByName("notepad")
p.Kill()
p.Close()
Next
End Sub

Private Sub ListBox_Items()
ListBox1.Items.Clear()
For Each p As Process In Process.GetProcesses
If Not ListBox1.Items.Contains(p.ProcessName) Then
ListBox1.Items.Add(p.ProcessName)
End If
Next
ListBox1.Sorted = True
End Sub

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ListBox_Items()
End Sub
End Class

assasa.PNG