Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
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?


Posted
Updated 16-Jul-15 9:35am
v4

1 solution

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

www.testurl.com

instead of

http://www.testurl.com as a link in a rich text box , is that right?
 
Share this answer
 
Comments
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 http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox. 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