On my program I have 2 forms. First one is to save information to xml file from textboxes and the second for is to search xml elements based on text that I write in textbox and show them in listview.
The problem is that when I get the results, in listview everything looks fine, but when I click the item in listview I get all information for xml element with index 0.
This is the code I use to search the xml and the code for SelectedindexChanged:
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
XmlDocument cDoc = new XmlDocument();
cDoc.Load(path + "\\MyProgram\\Data.xml");
var doc = XDocument.Load(path + "\\MyProgram\\Data.xml");
var q = from el in doc.Root.Elements("Register")
let str = el.Element("Name").Value
where str.ToLower().Equals(textBox1.Text)
select new ListViewItem(el.Elements().Select(x => x.Value).ToArray());
listView1.Items.AddRange(q.ToArray());
and for selectedIndexChange
name.Text = History[listView1.SelectedItems[0].Index].Name;
lastname.Text = History[listView1.SelectedItems[0].Index].Lastname;
Please help me because it's begin a week that I'm searching for a solution.