[FONT="]Hi all,
I'm new to vb.net 2005 and would like some help on some issues regarding populating a lable with an attribute in the same node as the one selected in a combobox. I have downloaded an xml file from msdn with all the product keys I have so far, I can populate the combobox using this code;[/FONT]
[FONT="]So the attribute "Name" loads fine in the combobox, but I can’t wrap my brain around a simple (or complex) way to populate the lblKey.Text property with the "Key" attribute based on the selection made in the combobox. Any pointers you can give me on how to do this?[/FONT]
I'm new to vb.net 2005 and would like some help on some issues regarding populating a lable with an attribute in the same node as the one selected in a combobox. I have downloaded an xml file from msdn with all the product keys I have so far, I can populate the combobox using this code;[/FONT]
[FONT="]Dim dom As New Xml.XmlDocument
dom.Load("ProductKeys.xml")
cmbProduct.Items.Clear()
Dim myAttr As Xml.XmlAttribute
For Each myAttr In dom.SelectNodes("/Your_Product_Keys/Product_Key/@Name")
cmbProduct.Items.Add(myAttr.InnerText)
Next
cmbProduct.SelectedIndex = 0[/FONT][FONT="][/FONT]
[FONT="]And the ProductKeys.xml look like this (a snippet of it anyway);[/FONT]dom.Load("ProductKeys.xml")
cmbProduct.Items.Clear()
Dim myAttr As Xml.XmlAttribute
For Each myAttr In dom.SelectNodes("/Your_Product_Keys/Product_Key/@Name")
cmbProduct.Items.Add(myAttr.InnerText)
Next
cmbProduct.SelectedIndex = 0[/FONT][FONT="][/FONT]
[FONT="]<?xml version="1.0" standalone="yes" ?>
<Your_Product_Keys> [/FONT]
[FONT="] <Product_Key Name="BackOffice Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" /> [/FONT]
[FONT="] <Product_Key Name="BizTalk Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" /> [/FONT]
[FONT="] <Product_Key Name="BizTalk Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" />[/FONT]
[FONT="]</Your_Product_Keys>[/FONT]
[FONT="] [/FONT]<Your_Product_Keys> [/FONT]
[FONT="] <Product_Key Name="BackOffice Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" /> [/FONT]
[FONT="] <Product_Key Name="BizTalk Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" /> [/FONT]
[FONT="] <Product_Key Name="BizTalk Server 2000" Key="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Key_Type="Retail" />[/FONT]
[FONT="]</Your_Product_Keys>[/FONT]
[FONT="]So the attribute "Name" loads fine in the combobox, but I can’t wrap my brain around a simple (or complex) way to populate the lblKey.Text property with the "Key" attribute based on the selection made in the combobox. Any pointers you can give me on how to do this?[/FONT]