Urgent: Syntax Highlighter [modified]
-
Hi there, I am creating a syntax highlighter in C#. I need to get text from a richtextbox and after clicking on a button, need to put the colorized text in another richtextbox. All I need is the simplest program for 1. multi-line comment (E.g.: /*My Comment*/) (in green color), 2. single line comment (E.g.: //My Comment) (in green color), 3. and a specific keyword called 'Item' (in blue color). Note that use if Regex is mandatory. Please Note: No custom controls such as the SyntaxRichTextBox should be used. I have been trying my hand on this since the past 3 days. Currently the problem is as follows: Suppose on one given line there is a comment as well as normal text as well as a keyword. So the text that is displayed in the second richtextbox has a line with the comment highlighted in green, then on the second line the same line is repeated with the keyword highlighted in blue. E.g: The text in the first richtextbox is as follows string item = "some string"; //Some Comment Here string is a keyword to be displayed in "blue" and //Some Comment sould be in Green So the second richtextbox displays this string as follows string item = "some string"; //Some Comment(in green) string(in blue) item = "some string"; //Some Comment whereas it should have displayed string(in blue) item = "some string"; //Some Comment(in green) -- modified at 1:16 Friday 23rd November, 2007
-
Hi there, I am creating a syntax highlighter in C#. I need to get text from a richtextbox and after clicking on a button, need to put the colorized text in another richtextbox. All I need is the simplest program for 1. multi-line comment (E.g.: /*My Comment*/) (in green color), 2. single line comment (E.g.: //My Comment) (in green color), 3. and a specific keyword called 'Item' (in blue color). Note that use if Regex is mandatory. Please Note: No custom controls such as the SyntaxRichTextBox should be used. I have been trying my hand on this since the past 3 days. Currently the problem is as follows: Suppose on one given line there is a comment as well as normal text as well as a keyword. So the text that is displayed in the second richtextbox has a line with the comment highlighted in green, then on the second line the same line is repeated with the keyword highlighted in blue. E.g: The text in the first richtextbox is as follows string item = "some string"; //Some Comment Here string is a keyword to be displayed in "blue" and //Some Comment sould be in Green So the second richtextbox displays this string as follows string item = "some string"; //Some Comment(in green) string(in blue) item = "some string"; //Some Comment whereas it should have displayed string(in blue) item = "some string"; //Some Comment(in green) -- modified at 1:16 Friday 23rd November, 2007
shehezada wrote:
Please help me. My Project Manager is breathing down my neck
shehezada wrote:
P.S.: I am new to .NET
How about buying a new book and learning ? Check this[^] for a good syntax highlighter
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Hi there, I am creating a syntax highlighter in C#. I need to get text from a richtextbox and after clicking on a button, need to put the colorized text in another richtextbox. All I need is the simplest program for 1. multi-line comment (E.g.: /*My Comment*/) (in green color), 2. single line comment (E.g.: //My Comment) (in green color), 3. and a specific keyword called 'Item' (in blue color). Note that use if Regex is mandatory. Please Note: No custom controls such as the SyntaxRichTextBox should be used. I have been trying my hand on this since the past 3 days. Currently the problem is as follows: Suppose on one given line there is a comment as well as normal text as well as a keyword. So the text that is displayed in the second richtextbox has a line with the comment highlighted in green, then on the second line the same line is repeated with the keyword highlighted in blue. E.g: The text in the first richtextbox is as follows string item = "some string"; //Some Comment Here string is a keyword to be displayed in "blue" and //Some Comment sould be in Green So the second richtextbox displays this string as follows string item = "some string"; //Some Comment(in green) string(in blue) item = "some string"; //Some Comment whereas it should have displayed string(in blue) item = "some string"; //Some Comment(in green) -- modified at 1:16 Friday 23rd November, 2007
shehezada wrote:
I need to get text from a richtextbox and after clicking on a button, need to put the colorized text in another richtextbox.
Check this out http://www.codeproject.com/cs/miscctrl/SyntaxRichTextBox.asp[^]
shehezada wrote:
Please help me. My Project Manager is breathing down my neck. P.S.: I am new to .NET HELLLLLPPPPPPP
Do not use words like these. These are considered very rude in discussion forums. I would suggest you could review http://www.codeproject.com/scrapbook/forumguidelines.asp[^].
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson