Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: You Receive "Run-Time Error 5" When You Call the Navigate2 Method of the WebBrowser Control


Symptoms

In a Microsoft Visual Basic application, when you call the Navigate2 method of the WebBrowser control, and then you pass string variables as parameters, you may receive the following error:
run-time error 5 "Invalid procedure call or argument"

↑ Back to the top


Resolution

To resolve this problem, use variant-type variables instead of strings.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. Start Visual Basic.
  2. Create a new Standard EXE project. By default, Form1 is created.
  3. Add a WebBrowser control to Form1, and then add the following code to Form1:
    Sub Form_Load()
        Dim strUrl As String 
        ' To resolve the problem, change to Variant.
        ' For example: Dim strUrl As Variant
    
        strUrl = "http://www.microsoft.com/"
        WebBrowser1.Navigate2 strUrl
    End Sub
    					

↑ Back to the top


References

For more information about how to use the WebBrowser control, visit the following Microsoft Developer Network (MSDN) Web site:For more information about how to develop Web-based solutions for Microsoft Internet Explorer, visit the following MSDN Web sites:

↑ Back to the top


Article Info
Article ID : 279668
Revision : 10
Created on : 1/1/0001
Published on : 1/1/0001
Exists online : False
Views : 146