Dim myProcess As New Process() '先定义一个进程变量
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
myProcess.StartInfo.FileName = "Notepad"
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
myProcess.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
myProcess.CloseMainWindow() '关闭进程
End Sub