Interop.SHDocVw not found, after added as reference

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I am trying to take a working VB.NET program (the SHOW HTML program
from the Halvorson book) and pass in parameter values which are used to
build the URL that IE looks up.

The original program works with a fixed URL, such as
"http://www.microsoft.com". Interop.SHDocVw is part of the original
program.

However, when I bring in values from outside the program, the url
string is built correctly, but the program crashes saying:

"File or assembly name Interop.SHDocVw, or one of its dependencies,
were not found."
Any help resolving this would be greatly appreciated.

Mark
 
Mark,

In the way you describe it, it should not crash, are you sure you set a
complete url in it including the http://

Cor
 
Cor said:
Mark,

In the way you describe it, it should not crash, are you sure you set a
complete url in it including the http://

Cor

Yes. I can paste the new url in and it works fine (in the original
program). The problem seems to be where the call to IE happens after
the parameter values are passed in. It never gets launched.
I have used the MessageBox.Show method to show me the values on the
screen as the program executes, and they all get passed in OK.

I must mention that this is VB.NET 2003, and that I have included the
Interops.SHDocVw library, but it doesn't work. Overall, I'm not
impressed with the whole Interops library concept, but that is another
discussion.
 
Crouchie1998,
I went to the support site you listed, and couldn't understand what it
was trying to tell me. I'm not that sophisticated or experienced in
VB.NET yet. Thanks for your help, though.
 
Mark,

You don't believe it, however I don't have the Halverson book.

Can you show what is so special on it.

Cor
 
Cor said:
Mark,

You don't believe it, however I don't have the Halverson book.

Can you show what is so special on it.

Cor

Here is the original code:

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button

'Required by the Windows Form Designer
Private components As System.ComponentModel.Container

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(40, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(392, 24)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Enter the URL for a valid HTML document and
click Display HTML"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(192, 160)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 32)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Display HTML"
'
'ComboBox1
'
Me.ComboBox1.DropDownWidth = 392
Me.ComboBox1.Location = New System.Drawing.Point(40, 64)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(392, 21)
Me.ComboBox1.TabIndex = 0
Me.ComboBox1.Text = "http://www.microsoft.com"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(480, 245)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.Button1, Me.Label1, Me.ComboBox1})
Me.Name = "Form1"
Me.Text = "Show HTML"
Me.ResumeLayout(False)

End Sub

#End Region

Public Explorer As SHDocVw.InternetExplorer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Explorer = New SHDocVw.InternetExplorer()
Explorer.Visible = True
Explorer.Navigate(ComboBox1.Text)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Add a few useful Web sites to the combo box at startup
ComboBox1.Items.Add("http://www.microsoft.com")
ComboBox1.Items.Add("http://www.microsoft.com/mspress")
ComboBox1.Items.Add("http://msdn.microsoft.com/vbasic")
ComboBox1.Items.Add("http://www.devx.com")
End Sub

End Class

'end of program

The problem occur when I put the following code in to build the URL
text that goes in the ComboBox1 object.

Dim MyStartupArguments() As String, intCount As Integer
MyStartupArguments = System.Environment.GetCommandLineArgs()
For intCount = 0 To UBound(MyStartupArguments)
myVariable1 = MyStartupArguments(1) 'Takes the first
argument off the command line
myVariable2 = MyStartupArguments(2) 'Takes the second
argument off the command line
myVariable3 = MyStartupArguments(3) 'Takes the third
argument off the command line
Next
This appears to block the initiation of the IE application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top