Hello,
I am trying to load a listview control from a xml file...my code seems to load a few items but not all the items.....here is the code...
this loads the first couple items from the xmlItem list...i use the messagebox to see if all the xml elements were loaded into the list...they were....so i am a little confused as to why this doesn't work..
thank you for any help
-Inked
I am trying to load a listview control from a xml file...my code seems to load a few items but not all the items.....here is the code...
string doc = "gowStats.xml"; if (!File.Exists(doc)) { MessageBox.Show("file doesnt exist"); } else { try { using (XmlReader reader = XmlReader.Create("gowStats.xml")) { int index = 0; while (reader.Read()) { switch (reader.Name) { case "Members": members = ""; break; case "Handle": member = reader.ReadString(); xmlItem.Add(member); break; case "Rank": rank = reader.ReadString(); xmlItem.Add(rank); break; case "Power": power = reader.ReadString(); xmlItem.Add(power); break; case "Cords": cords = reader.ReadString(); xmlItem.Add(cords); break; case "Loyalty": loyalty = reader.ReadString(); xmlItem.Add(loyalty); break; } } //foreach (var item in xmlItem) //{ // MessageBox.Show(item); //} ListViewItem lvi = new ListViewItem(xmlItem[0]); // listView1.Items.Add(lvi); for (int i = 1; i < xmlItem.Count; i++) { lvi.SubItems.Add(xmlItem[i]); listView1.Items.Add(lvi); } } } catch { return; } }
this loads the first couple items from the xmlItem list...i use the messagebox to see if all the xml elements were loaded into the list...they were....so i am a little confused as to why this doesn't work..
thank you for any help
-Inked