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



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5

This article was previously published under Q279668

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"

RESOLUTION

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

STATUS

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

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
    					

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:

Modification Type:MajorLast Reviewed:4/21/2006
Keywords:kbprb kbpending kbWebBrowser KB279668 kbAudDeveloper