Silddiombreodh
New Member
I have one xml file which at the end of the file has a comment which shows how many \[code\]<title>\[/code\] nodes are inside the file.\[code\]<?xml version="1.0" encoding="utf-8"?><DB><Letter name="0-9"><title>300 (2006)</title><title>2001: A Space Odyssey (1968)</title>...</Letter><Letter name="A"><title>Argo (2012)</title><title>Avatar (2009)</title>...</Letter>....</DB><!-- 1131 -->\[/code\]With this function I just add the titles from the selected letter to the list. How should I modify it so that at the end of this process, it reads the last node (comment) and saves it to lets say, \[code\]int count;\[/code\]\[code\]XmlTextReader xtr = new XmlTextReader(mypath);while (xtr.Read()){ if (xtr.NodeType == XmlNodeType.Element) if (xtr.Name == "Letter" && xtr.GetAttribute(0) == lbMovies.SelectedItem.ToString()) { lbMovies.Items.Clear(); while (xtr.Read()) { if (xtr.Name == "title") lbMovies.Items.Add(xtr.ReadString()); else if (xtr.Name == "Letter") break; } break; }}xtr.Close();\[/code\]