2

This is my first time doing my work with HAP, but I find a problem with HtmlDocument class, I can't use it, because intellisense tells me that it is ambiguous reference, this is the picture : enter image description here

I have imported the library needed it this code which are using HTML_Agility; using HtmlAgilityPack; and I also add reference to its DLL file but it can't help me so much. Do you know why this happens and how to fix it?

Picrofo Software
  • 5,475
  • 3
  • 23
  • 37
Raditya Kurnianto
  • 734
  • 1
  • 16
  • 42

2 Answers2

3

There's also exists a System.Windows.Forms.HtmlDocument class.

Try explicitly qualifying your classname instead of using a using statement, or rename the class with a using statement such as using HAPDocument = HtmlAgilityPack.HtmlDocument; (and then use HAPDocument instead of HtmlDocument in your source code).

ChrisW
  • 54,973
  • 13
  • 116
  • 224
2

To avoid the ambiguous reference write like this:

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
Stefan P.
  • 9,489
  • 6
  • 29
  • 43
  • Thank you @Stefan P for this. now, do you how to get some html content such as text because I want to extract it and show the on my text box? – Raditya Kurnianto Nov 04 '12 at 13:57
  • take a look at this http://stackoverflow.com/questions/2785092/c-htmlagilitypack-extract-inner-text – Stefan P. Nov 04 '12 at 14:11