formatting XMl data in a richtextbox

D

daisy

Hi

I have a windows form application in which I fetch some
some from database and display it in an XML format.
I display data in a rich text box. It displays data
correctly. I want the data to be formatted like a tree
view with colours i.e how XML appears in IE.
What do I need to do to achieve this.
I use the following code to display data in the richtext
box.

XmlDocument empDoc = new XmlDocument();
empDoc.PreserveWhitespace = true;
empDoc.Load(empReader);
String str = empDoc.OuterXml;
return str;

Thanks in advance
Daisy
 
R

Rick Strahl [MVP]

There's nothing that's going to do this for you automatically in a
RichTextbox.

If all you want to do is display the data then I'd suggest you use a
WebBrowser control and dump to file then view that and you will get IE's
display of XML for it in your app. For display this is easy and works well.

if you need editing then there are some third party controls that might
support syntax color highlighting for various formats including HTML.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top