Member 11201346 wrote:
"Thanks Bill, but no, this is in Windows.Forms. I don't have code because what is supposed to work (listed above) does not even compile. They've deleted the above methods and properties from RichTextBox. MS changed how all this works without explaining what the changes are."
In Windows Forms, there is no:
"RichTextBox.InsertLink
RichTextBox.IsDocumentEnabled
Hyperlink and TextPointer"
Those are properties/methods/etc. of the WPF RichTextBox.
The WinForms RichTextBox has a 'DetectUrls property which, if set to 'true, will recognize url's: but, as you may know, the links must start with one-of: ":http:, file:, mailto:, ftp:, https:, gopher:, nntp:, prospero:, telnet:, news:, wais:, outlook:" ... has to be a full properly formatted link.
To enter arbitrary Text that
behaves as a link (when you click it, triggers an EventHandler for the RTB LinkClicked Event: you have to use the Windows API, and set 'DetectUrls to 'false.
Fortunately, CodeProject is your friend, and here's how that's done: "Links with arbitrary text in a RichTextBox:" [
^].
And, you are even luckier, because: a newer article here (October, 2014) appears to go beyond what the first article offers: "AnyLinkRichTextBox:" [
^].
I have tried the 'AnyRichTextBox, and you'll see some comments I made on the article, and the author's response. I'm not sure if the author has fixed the bug I reported.