|
-
Jun 19th, 2013, 02:45 AM
#1
Thread Starter
New Member
[RESOLVED] [Question]Xml attributes into TextBox
Hi there,
So here's my xml file. I would like to do is to get all the Tab value into my textbox using a button to do so.
Code:
<?xml version="1.0" standalone="yes"?>
<programsetting>
<Main>
<Test Tab="1" />
<Test Tab="2" />
<Test Tab="3" />
<Test Tab="4" />
</Main>
</programsetting>
Here's my button code but was able to get the 1st tab value = "1" though.
Code:
doc.Load("Copy of GUI_Setting.xml")
Dim node As XmlNode = doc.SelectSingleNode("/programsetting/Main/Test")
Dim att = node.Attributes("Tab")
For Each whatever In att
TextBox2.Text = att.Value
Next
Thank you.
-
Jun 19th, 2013, 12:49 PM
#2
Re: [Question]Xml attributes into TextBox
I haven't tried running it but something like this should work
Code:
doc.Load("Copy of GUI_Setting.xml")
Dim node As XmlNode
Dim nodeList As XmlNodeList = doc.SelectNodes("/programsetting/Main/Test")
Dim att = XmlAttribute
For Each node In nodeList
att = node.Attributes("Tab")
TextBox2.Text = TextBox2.Text & att.Value & vbCrLf
Next
Last edited by MarkT; Jun 19th, 2013 at 12:59 PM.
-
Jun 19th, 2013, 08:13 PM
#3
Thread Starter
New Member
Re: [Question]Xml attributes into TextBox
 Originally Posted by MarkT
I haven't tried running it but something like this should work
Code:
doc.Load("Copy of GUI_Setting.xml")
Dim node As XmlNode
Dim nodeList As XmlNodeList = doc.SelectNodes("/programsetting/Main/Test")
Dim att = XmlAttribute
For Each node In nodeList
att = node.Attributes("Tab")
TextBox2.Text = TextBox2.Text & att.Value & vbCrLf
Next
Thanks for the reply.
It ain't able to work. And give out an error "Object reference not set to an instance of an object." @ TextBox2.Text = TextBox2.Text & att.Value & vbCrLf
Oh and by the way, DIm att = XmlAttribute need to be Dim att As XmlAttribute
-
Jun 20th, 2013, 03:01 AM
#4
Thread Starter
New Member
Re: [RESOLVED] [Question]Xml attributes into TextBox
Nvm. I found a solution already. THANKS!!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|