In Focus
MOBILE: HTML 5 vs. Native Apps
Istanbul Chapter May 2013 2nd Seminar Announced : Learn WinJS, Windows Store, MVC
ANNOUNCEMENT: April 2013 Month Winners
Email :
Password :
Remember me?
Forgot password
Contribute
An Article
A Blog
A News
A Video
A Link
An Interview Question
Ask a Question
TECHNOLOGIES
.NET 4.5
Current Affairs
JQuery
SharePoint 2010
Web Development
.NET Assemblies
Databases & DBA
Learn .NET
SharePoint 2013
Web Services in C#
ADO.NET in C#
Design & Architecture
LightSwitch 2012
Silverlight with C#
Windows 8
AJAX in C#
Exception Handling C#
LINQ
Smart Devices
Windows Azure
Android Programming
Graphics Design
Mobile & Embedded
SQL
Windows Controls C#
Articles C#
Hardware
Office 2013
SQL Server 2012
Windows Forms C#
ASP.NET Controls in C#
How do I
OOP/OOD
Testing
Windows Phone 8
ASP.NET MVC with C#
HTML 5
Operating Systems
TypeScript
Windows Server 2012
ASP.NET Programming
Internet & Web
PHP
Visual C#
Windows Store Apps
C# Language
iPhone/iPad
Products
Visual Studio .NET
Workflow Foundation in C#
C# Tutorials
Java
Reports using C#
Visual Studio 2010
WPF
C, C++, MFC
Java and .NET
Robotics & Hardware
Visual Studio 2012
XAML
Career Advice
JavaScript, CSS
Security in .NET
WCF with C#
XML
Chapters
Request a new Category
|
View All
ANSWERS
BLOGS
VIDEOS
INTERVIEWS
BOOKS
LINKS
NEWS
CHAPTERS
CAREER ADVICE
After 3rd C# Corner ISTANBUL Chapter Seminar
HTML 5 vs Native Apps
GridView New Feature in ASP.NET 4.0
Secure Your Android Application from Hackers
Why to fear Object Oriented Programming approach
Check upcoming B'day in Asp.net
Happy Birthday Destin Joy
Access Master Page Control In Child Page
Popup Example in WPF
Example of Expander in WPF
Blog
Load an XML in a RichTextBox using C#
Posted by
Karthikeyan Anbarasan
in
Blogs
|
XML
on
Mar 31, 2011
The code snippet in this blog shows how to load and display an XML document in a RichTextBox control using C#.
Tweet
5704
0
0
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())
This Feature is Sponsored By
DynamicPDF Merger is a developers dream for interacting with any existing PDF documents. Merge, append, split, form fill, flatten stamp and so much more.
Why XML instead of HTML?
Read an xml file node by node
post comment
COMMENT USING
PREMIUM SPONSORS
DynamicPDF Developer Components
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
More Blogs from this Blogger
E-Book Released – SQL Server Integration Services (SSIS) Step by Step Tutorial
First Time awarded Microsoft MVP 2011 - The Most Prestigious Award
SQL Server Transact Basic to Expert - Check if a given value is numeric or not using SQL
Best way to Write an Article
Advantage and Disadvantage of using Connection Pooling
Advantage and Disadvantage of Binary Serialization
Metadata in an Assembly
Garbage collection in Framework
BRB for MindCracker
Achived a Small Milestone (50 Articles 75 Blogs)
View All
SPONSORED BY
DynamicPDF ReportWriter Suite
PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Follow @twitterapi
Latest Blogs
Show Data from Xml file into two gridview based on a condition
User Management With help of Session in three steps.
HTML 5 vs Native Apps
Visual C# Introduction
Software Engineering Paradigm
SQL Server Management Studio Keyboard Shortcuts
Operation taking longer than expected - Visual Studio 2012
Aligning a button to right bottom corner of the screen(Model Window) in Lightswitch
Why to fear Object Oriented Programming approach
Happy Birthday Destin Joy
View All
Poll
Result
All Polls
Favorite Computer Manufacturer
Who is your favorite Computer manufacturer?
Lenovo
HP
Dell
Toshiba
Acer
Sony
Who is your favorite Computer manufacturer?
Options
Votes
%
Lenovo
21
13.91
HP
9
5.96
Dell
19
12.58
Toshiba
54
35.76
Acer
43
28.48
Sony
5
3.31
Total
151
100%