Hey, I'm using a .xml to save a program's settings. I can create and save the settings to the .xml file but I can't read the data from the file, I always get null values.
Here's the loading code:
And here's the contents of Settings.xml:
Here's the loading code:
Code:
textReader = new XmlTextReader("c:\\settings.xml");
textReader.Read();
while (textReader.Read())
{
if (textReader.LocalName == "Username")
lblTest1.Text = textReader.Value;
if (textReader.LocalName == "Password")
lblTest2.Text = textReader.Value;
if (textReader.LocalName == "Adress")
lblTest3.Text = textReader.Value;
if (textReader.LocalName == "Database")
lblTest4.Text = textReader.Value;
}
And here's the contents of Settings.xml:
Code:
<?xml version="1.0"?>
<ROOT>
<Username>sa</Username>
<Password>teste</Password>
<Adress>teste</Adress>
<Database>Northwind</Database>
</ROOT>

