Ruttensoft
asked on
Reading XML Values...
I have a question reading XML-Files. I am writing it in this format:
<?xml version="1.0" ?>
- <!-- Template for Media Remote 2007
-->
- <MediaRemote2007>
- <Settings>
<Name>Test</Name>
<Author>Sven Rutten</Author>
<BackgroundImage />
- <Button1>
<Text>Button1</Text>
<BackColor>-1316371</BackC olor>
<ForeColor>-16777216</Fore Color>
<Left>78</Left>
<Top>119</Top>
<Width>75</Width>
<Height>23</Height>
<Command>Nothing</Command>
</Button1>
- <Button2>
<Text>Button2</Text>
<BackColor>-65281</BackCol or>
<ForeColor>-16711936</Fore Color>
<Left>11</Left>
<Top>170</Top>
<Width>93</Width>
<Height>26</Height>
<Command>Nothing</Command>
</Button2>
- <pb1>
<Left>16</Left>
<Top>25</Top>
<Width>64</Width>
<Height>48</Height>
<Command>Nothing</Command>
<Picture />
</pb1>
- <pb2>
<Left>80</Left>
<Top>0</Top>
<Width>56</Width>
<Height>40</Height>
<Command />
<Picture />
</pb2>
</Settings>
</MediaRemote2007>
I have several Buttons and Picturebox. How can I now loop through all these buttons and picturebox and read the values of them?
Thanks
Sven
<?xml version="1.0" ?>
- <!-- Template for Media Remote 2007
-->
- <MediaRemote2007>
- <Settings>
<Name>Test</Name>
<Author>Sven Rutten</Author>
<BackgroundImage />
- <Button1>
<Text>Button1</Text>
<BackColor>-1316371</BackC
<ForeColor>-16777216</Fore
<Left>78</Left>
<Top>119</Top>
<Width>75</Width>
<Height>23</Height>
<Command>Nothing</Command>
</Button1>
- <Button2>
<Text>Button2</Text>
<BackColor>-65281</BackCol
<ForeColor>-16711936</Fore
<Left>11</Left>
<Top>170</Top>
<Width>93</Width>
<Height>26</Height>
<Command>Nothing</Command>
</Button2>
- <pb1>
<Left>16</Left>
<Top>25</Top>
<Width>64</Width>
<Height>48</Height>
<Command>Nothing</Command>
<Picture />
</pb1>
- <pb2>
<Left>80</Left>
<Top>0</Top>
<Width>56</Width>
<Height>40</Height>
<Command />
<Picture />
</pb2>
</Settings>
</MediaRemote2007>
I have several Buttons and Picturebox. How can I now loop through all these buttons and picturebox and read the values of them?
Thanks
Sven
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This line should also be...
oNodeList = oRootNode.SelectNodes("/Me diaRemote2 007/Settin gs/Button" )
oNodeList = oRootNode.SelectNodes("/Me
Here is how you get the Text contents:
For Each oNode In oNodeList
MessageBox.Show(oNode.Item ("Text").I nnerText.T oString)
' You can loop through each button or picture box node and pull out the values
Next
Hope all of this helps,
Darren
For Each oNode In oNodeList
MessageBox.Show(oNode.Item
' You can loop through each button or picture box node and pull out the values
Next
Hope all of this helps,
Darren
ASKER
Thanks
take out the line
NewXmlDoc2.Save("C:\test\t