• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1089
  • Last Modified:

c# RichTextBox "real" urls?

ok I am not new to c#  but there must be an answer to this one... I am stumped!

The story so far ... I wanted to do have email functionality in my program, so after looking around I finally went for a VERY basic RichTextBox with an attached hand made rtf->(BASIC) html converter that sends the simple edits as HTML for my customers to write emails ... I want to write html very basically and for my needs my RichTextBox works fine ... with one problem

The only feature I am missing is Hyperlinks. And its MISSION CRITICAL. The nearest I can get is to do a "DetectUrl" work alike, where I physically screen the rtf for a string beginning "http://blah" and then I enclose that in a link in my HTML. It is a bad halfway house though. The PROBLEM is that I can't see an easy way of "combining" the Url behind some "link text"

ie:  
a) what I want to make : <a href="http://www.mypage.com">my link</a>
b) what I can do easily (from rtf text "http://www.mypage.com") : <a href="http://www.mypage.com">http://www.mypage.com</a>

I am stuck, I fear I have to disbale DetectUrls, go DEEP into rtf and somehow add comments (possibly) that can't bee seen in the box the user sees in but are pseudo written as "underlined in blue" and then I am terrified of mucking about that much. the user if he ever editted round such text would maybe make a RIGHT mess.. Is there anyone who has done this before? Is there an "easy" way of doing this? Should I be using RichTextBox's at all? I want html really, I only used rtf becaus eits there and its free.

Am I making any sense?

0
conan1975
Asked:
conan1975
1 Solution
 
RoninTheCommented:
probably you may use something like this....
http://www.codeproject.com/cs/miscctrl/RichTextBoxLinks.asp

this is an extension of the richtextbox.you can insert links with arbitrary text and then handle the LinkClicked event.
hth
0
 
conan1975Author Commented:
OK... You know, I was waiting to post my eventual solution... I had to make significant modifications after following RoninThe's suggestion in order to parse fully fleged RTF into HTML (with links!) I finally did it though (buts its in too many places in my code to parcel easily!)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now