Milk
Milk
CC#
Created by Milk on 6/8/2023 in #help
❔ "cant open file due to it being used by another process"
The process cannot access the file 'C:\Users\user\source\repos\Clickity\Clickity\bin\Debug\net6.0-windows\score.txt' because it is being used by another process
The process cannot access the file 'C:\Users\user\source\repos\Clickity\Clickity\bin\Debug\net6.0-windows\score.txt' because it is being used by another process
private void button4_Click(object sender, EventArgs e)
{
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
foreach (var item in listBox1.Items)
{
SaveFile.WriteLine(item.ToString());

}
SaveFile.Close();
}

private void button5_Click(object sender, EventArgs e)
{
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
string[] lines = File.ReadAllLines(sPath);

foreach (string line in lines)
Console.WriteLine(line);
SaveFile.Close();
}
private void button4_Click(object sender, EventArgs e)
{
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
foreach (var item in listBox1.Items)
{
SaveFile.WriteLine(item.ToString());

}
SaveFile.Close();
}

private void button5_Click(object sender, EventArgs e)
{
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath);
string[] lines = File.ReadAllLines(sPath);

foreach (string line in lines)
Console.WriteLine(line);
SaveFile.Close();
}
what im trying to do here is basically just write and read to a specific file. rather confusing
9 replies