When I click the button the first time, it works, but after that, it doesn't do anything. I have tried to debug this and I have looked it up but I can't find an answer. I am probably just not noticing something obvious.
private void button5_Click(object sender, EventArgs e)
{
string[] files;
files = Directory.GetFiles("Tasks");
foreach (string file in files)
{
string[] lines;
StreamReader reader = new StreamReader(file);
lines = File.ReadAllLines(file);
tasks.Add(lines[0]);
reader.Close();
}
listBox1.DataSource = tasks;
}