How can I add a hyperlink to a RichTextBox control?

Platform: WinForms| Category: RichTextBox

To add a hyperlink to the RichTextBox, so that it opens up the link you click on, ensure that DetectUrls property is set to True and call:


[C#]
private void richTextBox1_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
{
    System.Diagnostics.Process.Start(e.LinkText);
}

[VB.NET]
Private  Sub richTextBox1_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs)
    System.Diagnostics.Process.Start(e.LinkText)
End Sub

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.