?
Solved

Windows Forms show <a> tags as links

Posted on 2016-07-22
5
Medium Priority
?
80 Views
Last Modified: 2016-07-26
In a Windows Forms application, I have a RichTextBox control with the DetectUrls property set to true.

Using the following text:
Hello, and welcome to <a href="http://www.colgate.com">Colgate toothpaste</a>. Or if you prefer, just go to http://www.crest.com.
I get this result:
rtbWhat I really need is for it to render the string as a web browser would so it would look like this:
web
I'd even be OK if it rendered both the <a> tag and the explicit URL both as links but that's not necessary. What I really need is a way to render the <a> tag as a link. Any idea how I can accomplish this?
0
Comment
Question by:Russ Suter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41725119
you will need to use the web browser control instead of the rich text control
0
 
LVL 20

Author Comment

by:Russ Suter
ID: 41725120
I'm aware that the WebBrowser control will do this. Unfortunately that's not an option. I need to figure out how to make a RichTextBox (or similar) control do this.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41725137
sorry: not possible.
0
 
LVL 20

Author Comment

by:Russ Suter
ID: 41725139
Sorry, that's never an acceptable answer. It's always possible, even if I have to subclass the RichTextBox control myself. It seems that's what I'll be doing unless someone else can come up with an alternative.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1500 total points
ID: 41725158
Then it's no longer a pure richtextcontrol, but i presume you will consider that playing with words, which is ok for me.

Technically it puts linklabel objects into the text, so you can do indeed the same.
I would likely disable the detecturl property and put the links for both syntaxes.
As i am far from a pc for another 3 weeks, i cannot work out any code myself, but i understand tgat will not be an issue for you, as you know how to subclass existing control classes.

Note that i have never be a fan of neither the richtext nor the webbrowser control.
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question