Microsoft
Software
Hardware
Network
Question : "null reference exception was unhandled by user code" from Webbrowser when accessing body.innerhtml
Private Sub WebBrowser1_Navigated(ByVa
l sender As Object, ByVal e As System.Windows.Forms.WebBr
owserNavig
atedEventA
rgs) Handles WebBrowser1.Navigated
Dim cchtml As String
cchtml = WebBrowser1.Document.Body.
InnerHtml
End Sub
Using VB 2010 express.
Webbrowser on a form and have this code for the navigated event. Please does anyone know what causes this error. I'm assuming it's because the html in the browser doesn't have a body element or something. I Only want further code to run if there is. Is there something I can put in to pre-check it and avoid this crash?
null-reference.png
(15 KB)
(File Type Details)
crash
Answer : "null reference exception was unhandled by user code" from Webbrowser when accessing body.innerhtml
I would use something similar however VB doesn't use null so i would use the above code with "not nothing" instead of "<> null".
Random Solutions
Blackberry browser 400 error - socketexception Connection reset
Audit, log and RBAC on AIX
backup exec 2010 on esxi
How do I verify Using SSIS if an XML file exist in the folder , change it's name and move ot to an SFTP if exist
HP Laptop w/ Vista freezing regularly
NTLDR is Missing on HP Proliant ML350 G4 with Windows 2003 SP2
How to avoid zero(s) in front of number(s) disappears in array
Nested Gridviews RowDataBound Event Problem
V2P (Windows 2008)
VB .NET 2005 Combine Two Tables on Primary Key and Display in DataGridView