0

i am useing this code to read html pages :

 WebClient client = new WebClient();
            String htmlCode = client.DownloadString(@"C:\checkemails\check.html");
            // Replace all html breaks for line seperators.
            htmlCode = htmlCode.Replace("<br>", "\r\n");
            MessageBox.Show(htmlCode);

the html page is on C:\ but lets say i am loading yahoo.com.. or what ever page.

i need to find a div named who got the id of

<div id ="say">

how can i do so?

Alon M
  • 1,583
  • 7
  • 30
  • 44

1 Answers1

3

try using HTMLAgilityPack for this sort of thing...

for select item from a div see for example Select only items in a specific DIV using HtmlAgilityPack

Community
  • 1
  • 1
Yahia
  • 69,653
  • 9
  • 115
  • 144
  • what using does i need for it? – Alon M Aug 14 '11 at 07:26
  • it is a library - you can download it from codeplex, it comes with samples... just follow the first link in my answer. – Yahia Aug 14 '11 at 07:27
  • stupid qustion. i have never used librays, where do i put it ? – Alon M Aug 14 '11 at 07:33
  • Nver MIND! its works. the other thing you gave me isnt that good, any one have any other? – Alon M Aug 14 '11 at 07:36
  • put it wherever you want - the only important thing is to be able to "add reference" the HamlAgilityPack.dll in your project (also set copy local to true) and then in your source you add `using HtmlAgilityPack;` – Yahia Aug 14 '11 at 07:42
  • for more examples see http://runtingsproper.blogspot.com/2009/09/htmlagilitypack-article-series.html – Yahia Aug 14 '11 at 07:43