Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / July 2003

Tip: Looking for answers? Try searching our database.

formatting xml data in rich textbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
daisy - 16 Jul 2003 11:02 GMT
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
Ralph Gerbig - 16 Jul 2003 17:49 GMT
Hi,
for finding keywords etc. you can use regex I attached some code for
colorizing lines of course it works with words too:

Regex line = new Regex("(-------------------------------------)");

MatchCollection mcl;

mcl = line.Matches(chatTextBox.Text);

for (int i = 0; i <= mcl.Count; i++)

{

chatTextBox.SelectionColor = System.Drawing.Color.Blue;

chatTextBox.Select (mcl[i].Index,37);

}

Regex userregex = new Regex((this._name.ToString()));

MatchCollection mcu;

mcu = userregex.Matches(chatTextBox.Text);

for (int i = 0; i <= mcu.Count; i++)

{

chatTextBox.SelectionColor = System.Drawing.Color.Blue;

chatTextBox.Select (mcu[i].Index,this.Name.Length);

}

Signature

Mit freundlichen Gr??en -- Regards

Ralph Gerbig
www.ralphgerbig.de.vu
ikea.ralph@web.de

> Hi
>
[quoted text clipped - 15 lines]
> Thanks in advance
> Daisy

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.