473,397 Members | 1,974 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,397 software developers and data experts.

Problem with Webbrowser control....

When using the following code.....

------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim HTMLString As String

HTMLString = TextBox1.Text

Dim doc As mshtml.HTMLDocument = AxWebBrowser1.Document()
doc.body.innerHTML = HTMLString.ToString

End Sub
------------------------------------

I get the following error....

------------------------------------
An unhandled exception of type 'System.NullReferenceException' occurred in
InetTesting.exe

Additional information: Object reference not set to an instance of an
object.
------------------------------------
I don't understand what this error is telling me I need to do. (No that
Microsoft errors are cryptic or anything.....)

Thanks for your help!
Nov 22 '05 #1
3 2243
Oops.....this may be important.

The error occurs on the line that reads...."doc.body.innerHTML =
HTMLString.ToString".

"Jim Hubbard" <re***@groups.please> wrote in message
news:70*************@bignews1.bellsouth.net...
When using the following code.....

------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim HTMLString As String

HTMLString = TextBox1.Text

Dim doc As mshtml.HTMLDocument = AxWebBrowser1.Document()
doc.body.innerHTML = HTMLString.ToString

End Sub
------------------------------------

I get the following error....

------------------------------------
An unhandled exception of type 'System.NullReferenceException' occurred in
InetTesting.exe

Additional information: Object reference not set to an instance of an
object.
------------------------------------
I don't understand what this error is telling me I need to do. (No that
Microsoft errors are cryptic or anything.....)

Thanks for your help!

Nov 22 '05 #2
Seems that navigating to any URL (even "about:blank") before using the
innerHTML object eliminates the problem...
"Jim Hubbard" <re***@groups.please> wrote in message
news:M1************@bignews1.bellsouth.net...
Oops.....this may be important.

The error occurs on the line that reads...."doc.body.innerHTML =
HTMLString.ToString".

"Jim Hubbard" <re***@groups.please> wrote in message
news:70*************@bignews1.bellsouth.net...
When using the following code.....

------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim HTMLString As String

HTMLString = TextBox1.Text

Dim doc As mshtml.HTMLDocument = AxWebBrowser1.Document()
doc.body.innerHTML = HTMLString.ToString

End Sub
------------------------------------

I get the following error....

------------------------------------
An unhandled exception of type 'System.NullReferenceException' occurred
in InetTesting.exe

Additional information: Object reference not set to an instance of an
object.
------------------------------------
I don't understand what this error is telling me I need to do. (No that
Microsoft errors are cryptic or anything.....)

Thanks for your help!


Nov 22 '05 #3
Hi Jim

This is by design. The WebBrowser control must be initialised correctly
before you have access to the DOM. The usual way is to navigate to
about:blank, even if you intend to navigate somewhere else straight
afterwards.

Also, when you have navigated to about:blank the first time, make sure you
wait for the readystate to go to "complete", otherwise the control will not
be correctly initialised.

HTH

Charles
"Jim Hubbard" <re***@groups.please> wrote in message
news:cE***************@bignews1.bellsouth.net...
Seems that navigating to any URL (even "about:blank") before using the
innerHTML object eliminates the problem...
"Jim Hubbard" <re***@groups.please> wrote in message
news:M1************@bignews1.bellsouth.net...
Oops.....this may be important.

The error occurs on the line that reads...."doc.body.innerHTML =
HTMLString.ToString".

"Jim Hubbard" <re***@groups.please> wrote in message
news:70*************@bignews1.bellsouth.net...
When using the following code.....

------------------------------------
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim HTMLString As String

HTMLString = TextBox1.Text

Dim doc As mshtml.HTMLDocument = AxWebBrowser1.Document()
doc.body.innerHTML = HTMLString.ToString

End Sub
------------------------------------

I get the following error....

------------------------------------
An unhandled exception of type 'System.NullReferenceException' occurred
in InetTesting.exe

Additional information: Object reference not set to an instance of an
object.
------------------------------------
I don't understand what this error is telling me I need to do. (No that
Microsoft errors are cryptic or anything.....)

Thanks for your help!



Nov 22 '05 #4

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

Similar topics

5
by: Noozer | last post by:
I've got a WebBrowser control (AxBrowse - VCMAXB.DLL) and I'm having a few difficulties with it. Just looking for a few pointers, not whole solutions here. I've tried looking at the MSDN help files...
7
by: Mike | last post by:
Hi! I posted this question in browser_ctl group as well but got no results. I have a form with embedded WebBrowser. Upon clicking on a link in the embedded webbrowser that calls JavaScript's...
9
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
0
by: Jim Hubbard | last post by:
How would I implement the IDispatch interface to handle the following in VB.Net <BEGIN> Controlling Download and Execution The WebBrowser Control gives you control over what it downloads,...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
11
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
4
by: David | last post by:
I'm using the AxSHDocVw.WebBrowser control to download data from a webpage at work (it's an internal page on my company's intranet). The page produces a runtime error after a while and the...
3
by: Dom | last post by:
I have a prgram with a webBrowser control. The user can click on a Linked Reference and the webBrowser control shows that site. Sometimes the URL (not my program, but the URL I am browsing to)...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.