Click here to Skip to main content
15,877,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here's the issue:

Example: If I open an rtf file in Notepad and insert the following string somewhere,

{\field{\*\fldinst { HYPERLINK "TEST LINK" }}{\fldrslt {TEST}}}

save the file (as .rtf) and then load it into a RichTextBox, the link shows up as a clickable, underlined link. Great. This is what I want, a hyperlink with a non-standard link type (i.e. not one of the "standard" link types like file:/// or http:/// etc., just a plain old text link.)

HOWEVER, trying to insert the link directly into the richtextbox at runtime, like this:
(assume the selection is not nothing)

SelectedRtf="\rtf1\ansi {\field{\*\fldinst { HYPERLINK ""TEST LINK"" }}{\fldrslt {TEST}}}"

Fails to modify the rtf. Why is this?

Updated 16-Jul-15 9:35am

1 solution

Can you please clarify one thing :
Do you want something like this:

instead of as a link in a rich text box , is that right?
Share this answer
Kalkidas 17-Jul-15 8:40am    
No. I want to be able to hyperlink any text whatsoever in a richtextbox, so that it persists when the file is saved. But I'm wondering why I can't modify the rtf directly at runtime by inserting the HYPERLINK string I posted. Try the procedure I outlined and see what I mean. BTW I already know about I am trying to improve it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900