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. Detecting URL in RichTextBox Control?

Detecting URL in RichTextBox Control?

Scheduled Pinned Locked Moved C#
questionregex
6 Posts 4 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.
  • W Offline
    W Offline
    wienzzz
    wrote on last edited by
    #1

    Hai, On RichTextBox Control, there's a property "DetectUrls". When the property value is "true" then any word begin with "www." on that richTextBox will be treated as Hyperlink. my Question : How do we treat the text on richTextBox as hyperlink manually? Or, maybe there's any class that we could edit so there will be more word pattern to be treated as hyperlink? thankz for the information

    Mail me at erwin@holyknight.us

    C M 2 Replies Last reply
    0
    • W wienzzz

      Hai, On RichTextBox Control, there's a property "DetectUrls". When the property value is "true" then any word begin with "www." on that richTextBox will be treated as Hyperlink. my Question : How do we treat the text on richTextBox as hyperlink manually? Or, maybe there's any class that we could edit so there will be more word pattern to be treated as hyperlink? thankz for the information

      Mail me at erwin@holyknight.us

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      wienzzz wrote:

      How do we treat the text on richTextBox as hyperlink manually?

      Probably by using regex on the string.

      wienzzz wrote:

      Mail me at erwin@holyknight.us

      No-one is going to mail you, except spam bots. The site mails you when people reply to your messages, if you gave the site your address. I hope you d id, seeing as you're giving it to the world at large.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      W 1 Reply Last reply
      0
      • C Christian Graus

        wienzzz wrote:

        How do we treat the text on richTextBox as hyperlink manually?

        Probably by using regex on the string.

        wienzzz wrote:

        Mail me at erwin@holyknight.us

        No-one is going to mail you, except spam bots. The site mails you when people reply to your messages, if you gave the site your address. I hope you d id, seeing as you're giving it to the world at large.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        W Offline
        W Offline
        wienzzz
        wrote on last edited by
        #3

        Regex? I don't think that's what I mean. I suppose Regex is used to check over some word pattern, right? what I mean here is how to make some String (i.e hello, it is me) to be treated as hyperlink. Just like in html, when you want to put some hyperlink you put tag between the string. [hello, it is me]([this is the link to be clicked]) I've search through RichTextBox methods and properties, but I found nothing related to the hyperlink thing except DetectUrls and LinkClicked. Why am I using this? well, I try to retrieve some data in database and present them in the richTextBox. some fields need to be hidden until someone want to show it. And I'm thinking of using the hyperlink to be the trigger to show the hidden field. :confused::confused::confused: thankz for the info :rolleyes: Newbie.. Newbie.. Newbie.. Newbie.. Newbie.. -- modified at 1:00 Wednesday 10th October, 2007

        N 1 Reply Last reply
        0
        • W wienzzz

          Regex? I don't think that's what I mean. I suppose Regex is used to check over some word pattern, right? what I mean here is how to make some String (i.e hello, it is me) to be treated as hyperlink. Just like in html, when you want to put some hyperlink you put tag between the string. [hello, it is me]([this is the link to be clicked]) I've search through RichTextBox methods and properties, but I found nothing related to the hyperlink thing except DetectUrls and LinkClicked. Why am I using this? well, I try to retrieve some data in database and present them in the richTextBox. some fields need to be hidden until someone want to show it. And I'm thinking of using the hyperlink to be the trigger to show the hidden field. :confused::confused::confused: thankz for the info :rolleyes: Newbie.. Newbie.. Newbie.. Newbie.. Newbie.. -- modified at 1:00 Wednesday 10th October, 2007

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

          wienzzz wrote:

          Regex? I don't think that's what I mean.

          That is the good and fastest method to find any text matching to a pattern.

          wienzzz wrote:

          what I mean here is how to make some String (i.e hello, it is me) to be treated as hyperlink.

          You need to write a Regex pattern that finds "hello" from the text, and replaces the match with <a href="[this is the link to be clicked]">hello, it is me</a>


          My Website | Ask smart questions

          1 Reply Last reply
          0
          • W wienzzz

            Hai, On RichTextBox Control, there's a property "DetectUrls". When the property value is "true" then any word begin with "www." on that richTextBox will be treated as Hyperlink. my Question : How do we treat the text on richTextBox as hyperlink manually? Or, maybe there's any class that we could edit so there will be more word pattern to be treated as hyperlink? thankz for the information

            Mail me at erwin@holyknight.us

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            Hello! You might want to take a look here[^]

            Regards, mav -- Black holes are the places where God divided by 0...

            W 1 Reply Last reply
            0
            • M mav northwind

              Hello! You might want to take a look here[^]

              Regards, mav -- Black holes are the places where God divided by 0...

              W Offline
              W Offline
              wienzzz
              wrote on last edited by
              #6

              wow :omg: good stuff mav! this is what I'm looking for. thankz. I will start to explore your project thankz a lot

              Newbie.. Newbie.. Newbie.. Newbie.. Newbie..

              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