I'm creating a VB 2005 Express app that hosts the webbrowser control. Everything works well except one area: the Navigating event.
In that event, I need to evaluate the URL property of the webbrowser object. The URL is set beforehand in the browser object. I'm using Webbrowser1.URL .ToString to check it. However, I get the following error when I try this:
"A first chance exception of type 'System.NullRef erenceException ' occurred in (my program name)"
I created a test conditional to evaluate the URL property, as so:
If IsDBNull(Webbro wser1.Url) Then
MsgBox("null url")
Else
MsgBox("not null url")
End If
The result is that the URL is not null-- yet I get the error message above anyway!
Any clues on how to handle this?
Thanks,
Randall Arnold 2 5814
"Randall Arnold" <ra************ *******@nokia.c om.> schrieb I'm creating a VB 2005 Express app that hosts the webbrowser control. Everything works well except one area: the Navigating event.
In that event, I need to evaluate the URL property of the webbrowser object. The URL is set beforehand in the browser object. I'm using Webbrowser1.URL .ToString to check it. However, I get the following error when I try this:
"A first chance exception of type 'System.NullRef erenceException ' occurred in (my program name)"
I created a test conditional to evaluate the URL property, as so:
If IsDBNull(Webbro wser1.Url) Then MsgBox("null url") Else MsgBox("not null url") End If The result is that the URL is not null-- yet I get the error message above anyway!
Any clues on how to handle this?
Why IsDBNull? The type of System.Windows. Forms.WebBrowse r.Url is System.Uri.
It can /never/ be DBNull.Value. DBNull.Value is stored only in a database.
If you would want to know whether a property references an object, check for
Nothing:
If webbrowser1.url is nothing then
If I use
txtUrl.Text = WebBrowser1.Url .ToString
to display the new url, I never get a NullReferenceEx ception. Do you have a
public URL that I can use to repro the problem?
Armin
Ok, forget the Null test, as it turned out to be moot. The problem is in
Webbrowser1.URL .ToString . It won't do any good to post a url, and here's
why: that same bit of code works fine in the DocumentComplet e and Navigated
events. It just bombs in the Navigating event-- but I still need to
evaluate it there...
Randall Arnold
"Armin Zingler" <az*******@free net.de> wrote in message
news:OD******** ******@TK2MSFTN GP14.phx.gbl... "Randall Arnold" <ra************ *******@nokia.c om.> schrieb I'm creating a VB 2005 Express app that hosts the webbrowser control. Everything works well except one area: the Navigating event.
In that event, I need to evaluate the URL property of the webbrowser object. The URL is set beforehand in the browser object. I'm using Webbrowser1.URL .ToString to check it. However, I get the following error when I try this:
"A first chance exception of type 'System.NullRef erenceException ' occurred in (my program name)"
I created a test conditional to evaluate the URL property, as so:
If IsDBNull(Webbro wser1.Url) Then MsgBox("null url") Else MsgBox("not null url") End If The result is that the URL is not null-- yet I get the error message above anyway!
Any clues on how to handle this?
Why IsDBNull? The type of System.Windows. Forms.WebBrowse r.Url is System.Uri. It can /never/ be DBNull.Value. DBNull.Value is stored only in a database.
If you would want to know whether a property references an object, check for Nothing:
If webbrowser1.url is nothing then
If I use
txtUrl.Text = WebBrowser1.Url .ToString
to display the new url, I never get a NullReferenceEx ception. Do you have a public URL that I can use to repro the problem?
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: guy |
last post by:
Hi all -
And apologies if I'm in the wrong newsgroup. I'm a newbie here and I'd
certainly appreciate any pointers to the right forum. To the point...
We're running a WebBrowser object (through an AxWebBrowser activex control),
and have found that it navigates to a "cannot load" error page when the
network cable's unplugged. I should add at this point that we're trying to
navigate to a page on localhost ;-)
|
by: Dave Booker |
last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005.
I can instantiate an "AxWebBrowser browser" and refer to its members,
properties, and methods. I'm having trouble with the AxWebBrowser.Document:
When I print browser.Document.GetType().ToString() at runtime, I get
"mshtml.HTMLDocumentClass". But The VS2005 compiler does not recognize the
member AxWebBrowser.Document as anything other than a System.Object -- e.g.,...
|
by: FierceMuppet2 |
last post by:
I have VS2005 and I dropped WebBrowser control onto a form and navigated to a
page without any problem. Now, I want to access the HTML Document of the
control.
Dim d As System.Windows.Forms.HtmlDocument
d = obj.Browser.Document
v = d.all.item(Element).GetAttribute("value")
With this I am getting "Object refernece not set to instance of object.")
|
by: L. Chernov |
last post by:
Hello,
I am trying to work with .Net 2005 WebBrowser object,
and put it on a "Windows control library" (embedded in a user control class)
and then I
am executing it from an ASP.Net webform(with IE6) with the following object
tag:
<OBJECT id="ModPkiObj" height="550" width="800"
classid="http:ModPkiNew.dll#Mod.Online.Client.ModPkiNew.SignForm"
name="ModPkiObj" VIEWASTEXT>
|
by: Joe |
last post by:
Hi
I am able to embed Excel into a WebBrowser on my Dev machine but on a client
machine an instance of Excel starts in it's own window outside of my form.
I have used the WebBrowser with VS 2005 and the one with Office and get the
same result. I have use the MS example from MSDN and get the same result on
non-Dev machine
I've posted this before and someone remarked it maybe due to IE setting?
Does anyone know what the setting are and...
| |
by: jmalone |
last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has
AIX and does not want to install Python). The python script is pretty
simple (the only things it imports are sys and socket).
The README file in the Tools/freeze directory of the Python-2.4.4
distribution says the following (and many other things):
Previous versions of Freeze used a pretty simple-minded algorithm to
|
by: =?Utf-8?B?bGpsZXZlbmQy?= |
last post by:
I am having problems interacting with flash objects (i.e., Adobe Flash Player
9) in web pages when using a System.Windows.Forms.WebBrowser control. The
flash objects always seem to display correctly, but when I click on a link
within the flash object the WebBrowser often fails to navigate to the new
page. If I use IE6 (from outside by app) or an AxSHDocVw.AxWebBrowser
control (within my app) then everything works as expected.
You can...
|
by: dennijr |
last post by:
sry its long, questions in the last sentance if u wanna jump to it. i just decided that i would include everything that led up to the problem
i made a gif video that i wanted to put into a program, and i couldnt figure out how to get it into VB6. finally i found out that the Microsoft Internet Control would play the gif file if i located it with "webbrowser1.navigate" for example, so i did this. i decided it was working fine and...
|
by: TedTrippin |
last post by:
Hi,
Background - I've create a windows application in VS and added a WebBrowser component and all works well.
I'm now trying to do this programmatically. My application now listens on a socket and when it receives a request it creates a new Form and adds a new WebBrowser.
The problem - All works well without the WebBrowser, the form is visible, but when I do "Controls.Add(webBrowser)" I see nothing, not even something in the windows...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |