I'm programming in
VB, using Visual Studio 2008.
This is a Windows Forms program.
GOAL: I want to populate a multi column listbox with the <Name>, <Calories>, and <Fat> of each <Food> listed under a certain <Profile>.<Date>.<Name> from an xml file when I click
Button1. I've accomplished this using Excel spreadsheets as my data source, but now I want to use xml files for flexibility and portability.
Objects I'm using:
Here is my xml file (Foods.xml):
Code:
<?xml version="1.0" encoding="utf-8"?>
<Profiles>
<Profile>
<Name>Kelly</Name>
<Date>
<Name>Thursday: April 05, 2010</Name>
<Food>
<Name>Burger</Name>
<Calories>100</Calories>
<Fat>10</Fat>
</Food>
</Date>
</Profile>
<Profile>
<Name>Brandon</Name>
<Date>
<Name>Thursday: April 08, 2010</Name>
<Food>
<Name>Fries</Name>
<Calories>100</Calories>
<Fat>10</Fat>
</Food>
</Date>
</Profile>
</Profiles>
I don't even know where to begin with ListBoxes ... most of the online help seems to be for earlier versions of
VB, and VisualStudio 2008 is telling me that ".AddItem" is invalid syntax for ListBox1.
Anyone out there smarter than me?
EDIT:
Here is my latest attempt:
Code:
ListBox1.ObjectCollection.AddRange(New Object() {"System.Xml"})