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.

BUG: Type Mismatch Error When Calling ShowBrowserBar Without Optional Parameter


View products that this article applies to.

This article was previously published under Q251135

↑ Back to the top


Symptoms

Calling the InternetExplorer object's ShowBrowserBar method without the optional second parameter (pvarShow) produces the following error message:
Run-time Error '13':
Type Mismatch
The same error occurs if Null (or 0 or vbNull or vbNullString) is used for the second parameter.

↑ Back to the top


Cause

ShowBrowserBar does not check for the variant types VT_ERROR and VT_NULL (passed by a missing parameter and the Visual Basic keyword Null, respectively) when determining the validity of the pvarShow parameter.

↑ Back to the top


Resolution

The second parameter must be present and must be declared as a variant having one of three values: true, false, or empty (an uninitialized variant). Note that passing empty has the same effect as passing true, since the default action is to show the bar.

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add a reference to the Microsoft Internet Controls (Shdocvw.dll) using References on the Project menu.
  3. Copy the following code into the Code window of Form1:
    Dim WithEvents g_ieAuto As InternetExplorer
    
    Private Sub Form_Load()
       Set g_ieAuto = New InternetExplorer
       g_ieAuto.Visible = True
       g_ieAuto.Navigate2 "http://msdn.microsoft.com/workshop"
    End Sub
    
    Private Sub g_ieAuto_DocumentComplete(ByVal pDisp As Object, URL As Variant)
       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}"
    End Sub
    					
  4. On the Run menu, click Start or press the F5 key to start the program. The error message will appear.
  5. Change the call to ShowBrowserBar to the following:
       g_ieAuto.ShowBrowserBar "{30D02401-6A81-11D0-8274-00C04FD5AE38}", Empty
    					
  6. On the Run menu, click Start, or press the F5 key to start the program. The error message does not appear and the Search bar is displayed.

↑ Back to the top


References

For additional information, please see the following MSDN Web Workshop site:

↑ Back to the top


Keywords: kbbug, kbpending, KB251135

↑ Back to the top

Article Info
Article ID : 251135
Revision : 3
Created on : 5/12/2003
Published on : 5/12/2003
Exists online : False
Views : 454