Click here to Skip to main content
15,908,254 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to get values from web browser text to message box
web browser load only two or three chatterers at a time like "wp" or "wdr"

i tried this in document complete event
C#
string body="";
body = webbrowser1.DocumentText;
MessageBox.Show("" + body);


but message box contain
<div dir="ltr">swr</div>

screen shot

i want to remove all html tags and get text like swr
how should i do? have any other method?
thank in advance
Posted

1 solution

I would advise, for example, this:
http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace.aspx[^].

However, the whole idea looks like less than perfect to me. If some text is formatted as HTML, it was probably done on purpose in first place. Stripped from formatting, it might look ugly. Why not showing it as is, as rendered HTML? There great components provided at CodeProject could help:
A Professional HTML Renderer You Will Use[^],
WPF HTML Supported TextBlock[^].

—SA
 
Share this answer
 
Comments
Manoj Chamikara 7-Apr-13 0:48am    
Thank You Sergey Alexandrovich Kryukov i will try Regex.Replace Method
Sergey Alexandrovich Kryukov 7-Apr-13 1:13am    
You are welcome.
Will you accept the answer formally (green button)?
—SA

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