Hi people, i need to delete selected row in ListView from xml file..

i have this code:

private void tsBtnDeleteRow_Click(object sender, EventArgs e)
            if (listView1.SelectedItems.Count == 0) return;
            XmlDocument xmlDoc = new XmlDocument();
            //XmlNodeList newXMLNodes = xmlDoc.SelectNodes("/Pessoas/Pessoa[name=wd]");
            PessoaListViewItem item = (PessoaListViewItem)listView1.SelectedItems[0];
            string value = item.ToString();

            if (item != null)
                MessageBox.Show("A pessoa a remover é: " + item.MinhaPessoa.nome);

                foreach (XmlNode xNode in xmlDoc.SelectNodes("Pessoas"))
                    if (xNode.SelectSingleNode("Pessoa").InnerText == value)

                MessageBox.Show("Nenhuma pessoa seleccionada");


and this xml file:


Who can help?
Thanks and Happy BirthDay for me :)

Are you trying to remove all the data from within the Pessoa Element? That's what the if statement that checks against value looks to be doing to me.

What do you want the XML to look like when you are done?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.