We help IT Professionals succeed at work.

RichTextBox < ---- > Html Code

jjacksn
jjacksn asked
on
4,543 Views
Last Modified: 2010-08-05
Is there a control that can display html code (including graphics)?  

Also, how would I take input from a RichTextBox and convert all of the carriage returns to <br>?
Comment
Watch Question

Commented:
This converts carriage returns (\r) to <br>.

richTextBox1.Text = richTextBox1.Text.Replace("\r","<br>");

Change richTextBox1 to the name of your rich text box.

Commented:
Visual Studio 6.0 had the Microsoft Web Browser control, but that's not the best way to do it with .NET. You could open a new browser window with something like this:
System.Diagnostics.Process.Start("http://www.google.com");

or

using System.Diagnostics;

Process.Start("http://www.google.com");

Author

Commented:
My program sends out an e-mail with an html body and i would like to let the user perview it.  the web browser control is not in .NET?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Fahad MukhtarDistinguished Engineer

Commented:

Author

Commented:
This converts carriage returns (\r) to <br>.
richTextBox1.Text = richTextBox1.Text.Replace("\r","<br>");

didn't work.

isn't in \n not \r?  Second of all, replcaing "\n" or @"\n" in the string "1\n2\n3" doesn't change the string.
Fahad MukhtarDistinguished Engineer

Commented:
use richTextBox1.Text = richTextBox1.Text.Replace("\r\n","<br>");

Author

Commented:
Acctually, its too late at night and I was re-assinging the variable.  Replace("\n", <br>) works.  why is System.Envrionment.NewLine \r\n and the text from the rt box only has \n

Commented:
\r is a carriage return, \n is a newline.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.