Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > c# > june 2009 >

c# : Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument'


Paul Hemans
3/21/2006 12:00:00 AM
I am very new at .Net. I have a small project where I need to manipulate the
contents of a web page.

I have a form with a web browser control (webBrowser1) on it. Within the
webBrowser1_DocumentCompleted method I have the following code.

mshtml.HTMLDocument oDoc = new HTMLDocumentClass();

oDoc = (mshtml.HTMLDocument)webBrowser1.Document;

This is generating the error:

C:\learning\c#\myProject\myProject\Form1.cs(53,24): error CS0030: Cannot
convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument'



Can you give me any ideas on what I am doing wrong?

mailinglist2006
3/21/2006 2:22:58 PM
Hello,

I am looking for same information.

Thanks
ML

P.S. Paul, please update the answer here if you find it. Thanks
Paul Hemans
3/22/2006 12:00:00 AM
To solve that error I replaced the 2 lines:
mshtml.HTMLDocument oDoc = new HTMLDocumentClass();

oDoc = (mshtml.HTMLDocument)webBrowser1.Document;

with:
HtmlDocument oDoc = webBrowser1.Document;



[quoted text, click to view]

avinash
6/30/2009 10:36:32 PM
I am using winform webbrowser control in wpf application.when i am typecasting to html document it is throwing error message "Cannot convert type 'System.Windows.Forms.HtmlDocument' to 'mshtml.HTMLDocument'".
Any suggestion what to do..?.
Thanks in advance

From http://www.google.co.in/search?hl=en&q=Cannot+convert+type+'System.Windows.Forms.HtmlDocument'+to+'mshtml.HTMLDocument'&meta=&aq=f&oq=

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button