Page 1 of 1

RichTextBox - Open Detect URLs

Posted: Sat Sep 19, 2009 11:58 am
by CodenStuff
Hello,

A quick snip to show you how to launch a webpage from a link inside a richtextbox control. First you need to set the "DetectUrls" propertie to 'True' which will make URL text placed inside a richtextbox clickable.

Then use this code in the "RichTextBox LinkClicked" event:

To open in specific webbrowser:
Code: Select all
System.Diagnostics.Process.Start("iexplore.exe", e.LinkText)
To open in default webbrowser:
Code: Select all
System.Diagnostics.Process.Start(e.LinkText)
- credit to robby1998 for the default link

Its here just incase anyone needs it.

Happy coding cooll;

Re: RichTextBox - Open Detect URLs

Posted: Sat Sep 19, 2009 6:05 pm
by Nery
Can't you just use:
Code: Select all
Process.Start("e.LinkText")

Re: RichTextBox - Open Detect URLs

Posted: Sat Sep 19, 2009 7:18 pm
by CodenStuff
Hello Nery,

Yes you can, either way does the same job cooll; .

Thank you.

Re: RichTextBox - Open Detect URLs

Posted: Sun Sep 20, 2009 2:22 pm
by Nery
I knew it, it's just way more simple which means you can call the same action with a smaller piece of code. ^_^

Re: RichTextBox - Open Detect URLs

Posted: Sun Oct 11, 2009 5:56 pm
by Neki
The both ways are simple :)