473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need help in resolving a strange problem with htmldocument

2
Hi,

I have developed a small dll class which extracts me the innerhtml of a htmldocument.I am using mshtml lib in achieving the same.The code runs fine when using from another EXE.When I try to call the api from VSTS TestMethod,it fails.
It fails to build the htmldocument of the input html file.I get an error:
TestMethod1 threw exception: System.NullReferenceException: Object reference not set to an instance of an object..

I am not sure what is going wrong ,but if any one can give a hint I will be greatful.

Thanks in advance
Sam
Feb 25 '08 #1
3 1434
kenobewan
4,871 Expert 4TB
Please show us the relevant code, to see where the null reference occurs. Thanks.
Feb 25 '08 #2
sam6
2
Below is my code:

HTMLDocumentClass dom = new HTMLDocumentClass();
System.Runtime.InteropServices.ComTypes.IPersistFi le pf = (System.Runtime.InteropServices.ComTypes.IPersistF ile)dom;
IHTMLElementCollection tCol = hdoc.getElementsByTagName("table");

foreach(loop thru row)


I am trying to create a DataSet out of this HTMLDoc.
While accessing the DataSet for rows say
rowno = dataset.Tables["DataTable"].Rows.Count

I get a null ref error.

As I said ,this works fine with an exe ,but fails from VSTS test method.

Thanks
Sam6
Feb 25 '08 #3
kenobewan
4,871 Expert 4TB
You could try adding:

Expand|Select|Wrap|Line Numbers
  1. WebBrowser webControl = new WebBrowser();
  2.  
  3. webControl.DocumentText = "HTMLDocument";
  4.  
  5. do
  6.  
  7. {
  8.  
  9. Application.DoEvents();
  10.  
  11. } while (webControl.ReadyState != WebBrowserReadyState.Complete);
  12.  
Feb 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kookymon1 | last post by:
This is an attempt to respond to an older question (several months). Date: 2002-03-07 13:10:23 PST Subject: On the Common DOM API and Applets. The original message was: >LiveConnect and the...
9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
3
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...
0
by: | last post by:
Hi. I have an application that navigates between the framesets of a web page. To do this, I have used the Document_Complete event handler as follows: private void...
8
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...
2
by: plmanikandan | last post by:
Hi, I need to integrate the browser with my C# windows application. When I search thru the websites for this,I found SHDocVw.dll is needed for integrating Web browser into c# application.I...
0
by: TJ | last post by:
Hi, Here is what I did... mshtml.HTMLDocumentClass htc = new mshtml.HTMLDocumentClass(); mshtml.IHTMLDocument4 doc4 = htc; mshtml.IHTMLDocument2 doc2 = htc; doc2 =...
0
by: nickin4u | last post by:
I have a application that is used to automate certain task, I have been using mshtml.HTMLDocument class but certain events like click a button do not fire. I have tried a number of combinations but...
2
by: CSharper | last post by:
Is there a class I can use which loads HtmlDocument and performs default html validation to see if the document is a valid html document like XDocument? HtmlDocument seems to me only used to create...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.