Hi I'm currently learning to programm and i have run into a problem. I'm Saving user inputs into an xml file
private static void AddEntry(string GameName, string SavePath, string ExePath)
{
if (!File.Exists(docname))
{
CreateXml();
}
XDocument doc = XDocument.Load(docname);
XElement Game = doc.Element("Game");
Game.Add(new XElement("GameName", GameName), new XElement("SavePath", SavePath), new XElement("ExePath", ExePath));
doc.Save(docname);
}
private static void CreateXml()
{
XDocument SaveGameManager = new XDocument();
SaveGameManager.Declaration = new XDeclaration("1.0", "utf-8", "yes");
XElement Game = new XElement("Game");
SaveGameManager.Add(Game);
SaveGameManager.Save(docname);
}
now i need to be able to use these values, more specifically i need to use the GameName string in a dropdown menu. What is the simplest option for me to get this considering im not very experienced yet :)
edit: here is my xmlfile
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Game>
<GameName>sfsdf</GameName>
<SavePath>6835-256x256x8 (1).png</SavePath>
<ExePath>arduino-1.8.2-windows.exe</ExePath>
<GameName>fasdf</GameName>
<SavePath>ClassDiagram simple.vsdx</SavePath>
<ExePath>GameOfLife.exe</ExePath>
</Game>