Ralph Gerbig
7/16/2003 4:49:00 PM
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);
}
--
Mit freundlichen Grüßen -- Regards
Ralph Gerbig
www.ralphgerbig.de.vu
ikea.ralph@web.de
"daisy" <daisy1906in@yahoo.com> schrieb im Newsbeitrag
news:082201c34b81$511b8bd0$a501280a@phx.gbl...
> 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
>