Hi, ive just started C# and have a little problem. The below code is the program.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace killer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
{
//when this button is clicked, the console opens with a list of the processes
string str = @"G:\Killer\Finder.exe";
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
//This is just the File > Exit option
Application.Exit();
}
private void textBox_TextChanged(object sender, EventArgs e)
{
//now I need that when the user inputs text in "texBox" , the text entered will save in the var "killname"
string killname;
killname = textBox.Text;
}
private void button2_Click(object sender, EventArgs e)
{
{
Process[] procs = Process.GetProcessesByName("killname"); // Then here instead of killname (the var) it inputs the content of the var and kill that process
foreach (Process proc in procs)
proc.Kill();
}
}
}
}
What am I doing wrong ?
Thanks in advanced