0

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:

4
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by ProfessorPC
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.