shDocVw.dll in VB.Net 2003

Hello in there...

I'm having a small problem that's eluding attempts to resolve. I'm creating HTML in BuildCreateExportFilesResults(), which I'm writing to a file on the local hard drive. I want to display it in the shDocVw.webBrowser, but I can't make it work. Here's the code:

Public Sub DisplayCreateFilesResults()

Try

m_strMsg = ""
m_strMsg = BuildCreateExportFilesResults() '<-- creates a HTML page

With fStreamWriter
.WriteLine(m_strMsg)
.Flush()
.Close()
End With

strURL = Path.Combine(g_strApplicationDirectory, _
"DisplayProcFileResults.htm")

webBrowser.Navigate(strURL)

webBrowser.ExecWB( _
SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, _
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)

Catch
g_objFCAErrorHandler.Raise("", blah, blah, blah)_
End Try
End Sub

I receive an error, 91: Object reference not set to an instance of an object, when I execute webBrowser.Navigate(strURL). What am I missing

Thanks in advance for any help!

Mark




Answer this question

shDocVw.dll in VB.Net 2003

  • BBVB

    How are you creating your browser object If you are using the com object and dropping it from your toolbox then it creates the reference for you and something like:

    Me.AxWebBrowser1.Navigate(www.google.com)

    works just fine



  • yhz

    Stack Trace info for this error available



  • Ghawas

    >I wanted to keep it all .Net, but perhaps that's not in the cards....

    05 does have a .NET browser control...in 03 you either will have to use shdocvw.dll or create your own custom control.

    HTH



  • SGK

    DMan,

    Thanks for the response. I wanted to keep it all .Net, but perhaps that's not in the cards....

    Mark



  • Nicolas Mueggler

    Although it opens a new browser window, you could do:

    System.Diagnostics.Process.Start("iexplore.exe", "www.google.com")


  • shDocVw.dll in VB.Net 2003