2012-11-04 99 views
2

這是我第一次做我的工作與HAP,但我發現HtmlDocument類的問題,我不能使用它,因爲智能感知告訴我,這是不明確的引用,這是圖片: enter image description here我可以在Windows窗體應用程序中使用HTML Agility Pack嗎?

我已經導入了需要它的這個代碼庫,它的代碼是using HTML_Agility; using HtmlAgilityPack;,我也添加了對它的DLL文件的引用,但它不能幫到我很多。你知道爲什麼發生這種情況,以及如何解決它?

+1

做你嘗試'HtmlAgilityPack.HtmlDocument DOC =新HtmlAgilityPack.HtmlDocument();' –

回答

2

爲了避免不明確的引用這樣寫:

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

謝謝@Stefan對這筆。現在,你是否如何獲得一些HTML內容,如文本,因爲我想提取它並顯示在我的文本框? –

+0

看看這個http://stackoverflow.com/questions/2785092/c-htmlagilitypack-extract-inner-text –

3

還有一個System.Windows.Forms.HtmlDocument類。

儘量明確你的資格類名,而不是使用using聲明,或用using的語句,如using HAPDocument = HtmlAgilityPack.HtmlDocument;(然後用HAPDocument,而不是HtmlDocument在源代碼中)重命名類。

相關問題