populating a ComboBox from an XML file

Hello,

i was wondring if you could help me with this, i'm trying to load a combobox with elements from an XML file.

the problem is that the code i'm using only loads the first element.

my xml files has the following...


[code]




[/code]


so my ComboBox only shows the first name element and the first url element...any help will be great...thanks


[code]XmlDocument doc = new XmlDocument();
darkred]doc.Load("ComboItemName.xml");
XmlNodeList Nodes = doc.GetElementsByTagName("NAME");
foreach (XmlNode node in Nodes)
{
NewNameLoad = node.InnerText.ToString();
}
XmlNodeList NodesA = doc.GetElementsByTagName("URL");
foreach (XmlNode node in NodesA)
{
NewUrlLoad = node.InnerText.ToString();
}
comboChannels.Items.Add(new RSSChannel(NewNameLoad, NewUrlLoad));
// And select the first one
comboChannels.SelectedIndex = 0; [/code]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories