Populate a TextBox via XML?


I'm busy setting up an application I made to get details from an XML file and import the details into parts of my application. At present i've managed to populate List and Combo boxes using the below code, however can anyone show me how to import details into a TextBox?

This is the code i'm using to populate List and Combo Boxes with the details in the <test> tags within my XML file.

        Dim node1 As Xml.XmlNode = xmlDoc.SelectSingleNode("//test")
        If node1 IsNot Nothing Then
            For x As Integer = 0 To node1.ChildNodes.Count - 1
        End If

For the text box, it's called TextBox1 and the details I want to put in the text box are contained in the <text> tags in my XML file as shown below.


<?xml version="1.0" encoding="UTF-8"?>
<text>Description 1</text>


Many thanks,

Who is Participating?
Jorge PaulinoConnect With a Mentor IT Pro/DeveloperCommented:
Hi Paul,
You can do this way:

        Dim xmlDoc As New Xml.XmlDocument
        Dim node1 As Xml.XmlNode = xmlDoc.SelectSingleNode("//TextBox/text")
        If node1 IsNot Nothing Then
            Me.TextBox1.Text = node1.ChildNodes.Item(0).InnerText.ToString
        End If

Open in new window

m0tSiEAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.