views:

38

answers:

1

Specifically, im looking for a way to add links to all the words in my (rich)textbox that start with #. so, if my richTextBox1.Text property equaled "This is an #example of what i want" i would want "#example" to be highlighted. and if its clicked, id want to add a context menu for right click, and just on left click id want it to trigger a void in my program, with the text that was clicked.

A: 

Have a look at the following CodeProject article:

Links with arbitrary text in a RichTextBox
http://www.codeproject.com/KB/edit/RichTextBoxLinks.aspx

The code in this article will allow you to insert arbitrary text links into your RichTextBox. When the text link is clicked, the LinkClicked event will fire, and the LinkLabelLinkClickedEventArgs will contain the text of the link you clicked.

Robert Harvey
Im using the LinkClicked event for actual links.. but im sure ill be able to work something out. thanks! ill take a look.
Xavier