Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Urgent: Syntax Highlighter [modified]

Urgent: Syntax Highlighter [modified]

Scheduled Pinned Locked Moved C#
csharpregexhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shehezada
    wrote on last edited by
    #1

    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

    N V 2 Replies Last reply
    0
    • S shehezada

      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

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • S shehezada

        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

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups