473,738 Members | 9,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot convert type 'System.Windows .Forms.HtmlDocu ment' to 'mshtml.HTMLDoc ument'

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_Doc umentCompleted method I have the following code.

mshtml.HTMLDocu ment oDoc = new HTMLDocumentCla ss();

oDoc = (mshtml.HTMLDoc ument)webBrowse r1.Document;

This is generating the error:

C:\learning\c#\ myProject\myPro ject\Form1.cs(5 3,24): error CS0030: Cannot
convert type 'System.Windows .Forms.HtmlDocu ment' to 'mshtml.HTMLDoc ument'

Can you give me any ideas on what I am doing wrong?
Mar 21 '06 #1
2 14804
Hello,

I am looking for same information.

Thanks
ML

P.S. Paul, please update the answer here if you find it. Thanks

Mar 21 '06 #2
To solve that error I replaced the 2 lines:
mshtml.HTMLDocu ment oDoc = new HTMLDocumentCla ss();

oDoc = (mshtml.HTMLDoc ument)webBrowse r1.Document;

with:
HtmlDocument oDoc = webBrowser1.Doc ument;

"mailinglist200 6" <ma************ *@gmail.com> wrote in message
news:11******** *************@e 56g2000cwe.goog legroups.com...
Hello,

I am looking for same information.

Thanks
ML

P.S. Paul, please update the answer here if you find it. Thanks

Mar 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9426
by: James Dixon | last post by:
I have created a windows service in C#, .net framework 1.1 The service makes a web request using the mshtml.HTMLDocument.CreateDocumentFromURL() function Because this is not using Windows.Forms, I can't use the Application.DoEvents() function while the request is completing. Is there an equivilent function (call the CreateDocumentFromURL from a seperate thread and spin it until Document.readyState != "complete"?
2
28388
by: Evgeny Zoldin | last post by:
Hi ALL. I need to simulate send POST data ( - file upload) as it was submitted in Browser. In C# I create instanse of IE, navigate to page with the form, fill in the fields and try to Submit by call submitButton.click() Unfortunately it does not work while file_filed.vale = <path_to_file> has no effect, value <INPUT type=file...> cound not be set from script of that HTML page. Is there another way to set that value by means of ..NET ? Below...
7
4673
by: Robert May | last post by:
I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires appropriately, if I'm running it from a windows forms based application. However, when I run the EXACT same code under a windows service, either as a logged in user or as the local system account, the click fails to process. Clicking on other elements...
6
14378
by: juli | last post by:
I declared: public delegate void PaintEventHandler(object objSender,PaintEventArgs pea); and this.Paint+=new PaintEventHandler(MyPaintHandler); and the: static void MyPaintHandler(object objSender,PaintEventArgs pea) { }
8
8210
by: pierre | last post by:
Hi, I got a problem which may easy to resolve, but I can't find any issue: I want to parse html files, so, I want first get it from an url, and I do like that: Dim objMSHTML As New mshtml.HTMLDocument() Dim objDocument As mshtml.HTMLDocument objDocument = objMSHTML.createDocumentFromUrl("http://www.google.fr",
8
5404
by: copyco | last post by:
Is there a way to display formatted HTML in a Windows form? Or can I dynamically create an HTML file and then display that from a Windows Application? I can create a new HTML file in my project, but how do I reference it within my code, so I can manipulate it? Thanks.
0
2238
by: Atara | last post by:
Our application was build with VS 2003. I have tried to run it on a computer with .Net 2.0 (but without .Net 1.1 , as it should be used) and I got the following error - System.InvalidCastException: Unable to cast COM object of type 'mshtml.HTMLBodyClass' to class type ''. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type....
1
18197
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it is serialized correctly, and the server returns a response (I've captured the response and it's correct!) but when the .NET deserialize this response, it throws the exception "System.InvalidOperationException: There is an error in XML
0
2269
by: Qiang | last post by:
Anybody knows how to convert convert System.Windows.Forms.HtmlDocument to String? Any API or sample code will be greatly appreciated. thanks, Qiang
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.