I've been teaching myself how to code lately because I am bored. I am trying to load an XML file on startup and put the contents of that file into a listbox, then save the contents of the listbox to the file on close. That's exactly what I have now. However I want to be able to load from AppData as well as save back to the AppData folder without having to type the full path. I've tried using "%AppData%/Roaming/MyApp/data.xml" but that does not work and throws a exception.
Here is what I have now:
StreamReader sr = new StreamReader("data.xml");
line = sr.ReadLine();
while (line != null) {
Streamers.Items.Add(line);
line = sr.ReadLine();
}
Streamers.DataSource = line;
Streamers.Sorted = true;
sr.Close();
Console.ReadLine();