Load an XML in a RichTextBox using C#

This blog shows on how to load an XML in a RichTextBox control.

Public Sub LoadXMLtoBOX(ByVal strXMLPath As String)

        Me.rtbTextbox1.Text = ""

        Dim reader As New XmlTextReader(strXMLPath)
        While reader.Read()
            Select Case reader.NodeType
                Case XmlNodeType.Element
                    'The node is an element.
                    Me.rtbTextbox1.SelectionColor = Color.Blue
                    Me.rtbTextbox1.AppendText("<")
                    Me.rtbTextbox1.SelectionColor = Color.Brown
                    Me.rtbTextbox1.AppendText(reader.Name)
                    Me.rtbTextbox1.SelectionColor = Color.Blue
                    Me.rtbTextbox1.AppendText(">")
                    Exit Select
                Case XmlNodeType.Text
                    'Display the text in each element.
                    Me.rtbTextbox1.SelectionColor = Color.Black
                    Me.rtbTextbox1.AppendText(reader.Value)
                    Exit Select
                Case XmlNodeType.EndElement
                    'Display the end of the element.
                    Me.rtbTextbox1.SelectionColor = Color.Blue
                    Me.rtbTextbox1.AppendText("</")
                    Me.rtbTextbox1.SelectionColor = Color.Brown
                    Me.rtbTextbox1.AppendText(reader.Name)
                    Me.rtbTextbox1.SelectionColor = Color.Blue
                    Me.rtbTextbox1.AppendText(">")
                    Me.rtbTextbox1.AppendText(vbLf)
                    Exit Select
            End Select
        End While
        reader.Close()

    End Sub



    LoadXMLtoBOX(strXMLPath.ToString())