How can I make a hyperlink work in a RichTextBox?

  1. Make sure the text property includes a valid url. E.g. http://www.stackoverflow.com/

  2. set the DetectUrls property to true

  3. Write an event handler for the LinkClicked event.

Personally, I wouldn’t pass “IExplore.exe” in as a parameter to the Process.Start call as Microsoft advise as this presupposes that it is installed, and is the user’s preferred browser. If you just pass the url to process start (as per below) then Windows will do the right thing and fire up the user’s preferred browser with the appropriate url.

private void mRichTextBox_LinkClicked (object sender, LinkClickedEventArgs e) {
    System.Diagnostics.Process.Start(e.LinkText);
}

Leave a Comment