Code is as follows:
string fileName = "passfile.xml";
DataSet ds = new DataSet("Account List");
DataTable accounts = ds.Tables.Add("Accounts");
accounts.Columns.AddRange(new DataColumn[] {
new DataColumn("Username"),
new DataColumn("Password"),
new DataColumn("Description")});
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
foreach (XmlNode node in doc.GetElementsByTagName(accountGroupsBox.SelectedItem.ToString()))
{
DataRow row = accounts.Rows.Add(
node["Username"].InnerText,
node["Password"].InnerText,
node["Description"].InnerText);
}
dataGridView1.DataSource = accounts;
My XML File looks like this:
Well I couldnt figure out how to properly escape the XML, But there there is an element called Account with AccountType with inner text as Email Accounts, or Web Accounts or something similar that matches the items in the combo box. Addtionally there are other child elements such as Username, Password, ect.
The problem is when the code actually executes, the DataGridView fills with the proper rows and coulums, but where is nothing in them....what did I do wrong?