The solution to this is to write debuggable code and use the debugger.
Put a breakpoint on the first line of this function and run your app. What did you do to get this code to run? Do that again, and when the debugger stops the execution of the app, it'll show you in yellow which line is about to execute next. While the code is stopped, you can hover the mouse over variables and object properties to see their contents.
Doing crap like this is NOT debuggable code:
lbxSales.Items.Add(fileReader.ReadLine());
Separate those operations into their own lines so you can see what, if anything, was read.
string content = fileReader.ReadLine();
lbxSales.Items.Add(content);
Next, did anything get written to the file at all? Was it what you expected given your input? From what I can see, probably not.
This works:
private void SaveButton_Click(object sender, EventArgs e)
{
using (StreamWriter sw = new StreamWriter("Items.txt", true))
{
if (listBox1.SelectedIndex == -1)
{
foreach (var item in listBox1.Items)
{
sw.WriteLine(item);
}
}
}
}
private void LoadButton_Click(object sender, EventArgs e)
{
using (StreamReader sr = new StreamReader("Items.txt"))
{
while (!sr.EndOfStream)
{
string content = sr.ReadLine();
listBox1.Items.Add(content);
}
}
}
Oh, and get into the habit of using "using" blocks on Disposable objects.