here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace Wraith
{
public partial class WraithClient : Form
{
public WraithClient()
{
InitializeComponent();
}
private void test_Click_1(object sender, EventArgs e)
{
using (Process myProcess1 = new Process())
{
myProcess1.StartInfo.UseShellExecute = false;
myProcess1.StartInfo.FileName = "test.exe";
myProcess1.StartInfo.CreateNoWindow = true;
myProcess1.Start();
}
}
private void kill_Click(object sender, EventArgs e)
{
myProcess1.Kill();
}
}
}
the error I recieve is: "Error CS0103 The name 'myProcess1' does not exist in the current context" What I'm trying to do is to when the user clicks the kill button it will end the test.exe process. Is there any way to do this?