RoyLittle0
Active member
Hi,
I an trying to access the nodes in my xml based on the selection made in a combobox and write the text to a TabControl/TabPages, the area i am struggling with is "TabControl1.TabPages(i).Text = myMachineName.Attributes.ItemOf("Page").InnerText" so based on the code below how would i get the information out
I can get it to display the Machine Type by using
But i just cant seem to grasp the Page Number
XML
I an trying to access the nodes in my xml based on the selection made in a combobox and write the text to a TabControl/TabPages, the area i am struggling with is "TabControl1.TabPages(i).Text = myMachineName.Attributes.ItemOf("Page").InnerText" so based on the code below how would i get the information out
I can get it to display the Machine Type by using
VB.NET:
TabControl1.TabPages(i).Text = mySet.Attributes.ItemOf("Type").InnerText
VB.NET:
Public Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim NodeCount As Integer
For Each mySet As XmlNode In myXMLDoc.GetElementsByTagName("Machine")
If mySet.Attributes.ItemOf("Type").InnerText = ComboBox1.SelectedItem.ToString Then
For Each myMachineName As XmlNode In mySet.SelectNodes("Page")
NodeCount = 1
For i = 0 To 19
TabControl1.TabPages(i).Text = myMachineName.Attributes.ItemOf("Page").InnerText
Next
Next
End If
Next
End Sub
XML
VB.NET:
<Root>
<Machine Type="A Machine">
<Page Number="Page 1, Machine A">
<Title>1</Title>
<TextBox>2</TextBox>
<TextBox>3</TextBox>
<TextBox>4</TextBox>
<PictureBox>5</PictureBox>
<PictureBox>6</PictureBox>
<PictureBox>7</PictureBox>
<Link>8</Link>
</Page>
<Page Number="Page 2, Machine A">
<Title>9</Title>
<TextBox>10</TextBox>
<TextBox>11</TextBox>
<TextBox>12</TextBox>
<PictureBox>13</PictureBox>
<PictureBox>14</PictureBox>
<PictureBox>15</PictureBox>
<Link>16</Link>
</Page>
<Page Number="Page 3, Machine A">
<Title>17</Title>
<TextBox>18</TextBox>
<TextBox>19</TextBox>
<TextBox>20</TextBox>
<PictureBox>21</PictureBox>
<PictureBox>22</PictureBox>
<PictureBox>23</PictureBox>
<Link>24</Link>
</Page>
</Machine>
</Root>
Last edited: