Raditya Kurnianto
Raditya Kurnianto

Reputation: 744

Can I use HTML Agility Pack in Windows Forms Applications?

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?

Upvotes: 2

Views: 3036

Answers (2)

Stefan P.
Stefan P.

Reputation: 9519

To avoid the ambiguous reference write like this:

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();

Upvotes: 2

ChrisW
ChrisW

Reputation: 56123

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).

Upvotes: 3

Related Questions