Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi guys

I'm having trouble populating my Listview using a XML file

I want the XML to load in the listview when the program starts

here is the code i have

//should load favourite xml file in favourites list
            System.Xml.XmlDocument loadDoc = new System.Xml.XmlDocument();
            loadDoc.Load(Application.StartupPath + "\\favourites.xml");

            foreach (System.Xml.XmlNode favNode in loadDoc.SelectNodes("/favourites/Item"))
            {
                Trace.WriteLine(favNode.Attributes["url"].InnerText);

                lstFavs.Items.Add(favNode.Attributes["url"].InnerText);

            }


using trace i see that the xml file is being seen but is not loading on page
is there some setting in properties in visual studio 2010 that i need to change?

cheers for the help

i'm using webbrowser control to build a childs web browser, and i'm trying to load the favourite websites in the listview which is on the main form
Posted

1 solution

Here is a good example how to use ListView and XML together.Displaying ListView and XML[^]

I hope this will help you well.
 
Share this answer
 
Comments
sportsonpc 5-May-11 10:57am    
cheers buddy will have a good luck at it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900