I want to read Xmlfile and extract its contents to display on form in textbox using vb.net2003
How to use the XmlTextReader to read the contents of an XML document and extract the contents, if can be done....
:icon_cry:

Recommended Answers

All 3 Replies

Yes, you can just read the documentation of XMLReader in MSDN
www.msdn.com

Try this with a button & text box:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim m_Settings As New XmlReaderSettings()
m_Settings.ProhibitDtd = False
m_Settings.ValidationType = ValidationType.None

Dim m_reader As XmlReader = XmlReader.Create("C:\temp\myXML.xml", m_Settings)

While m_reader.Read()
Select Case m_reader.NodeType
Case XmlNodeType.Element
Exit Select
Case XmlNodeType.Text
TextBox1.Text += m_reader.Value + vbCrLf
Case XmlNodeType.EndElement
Exit Select
End Select
End While

End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.