Microsoft KB Archive/270589

= BUG: Run-Time Error Message -2147417848 (80010108) When Passing Array of Dictionary Objects =

Article ID: 270589

Article Last Modified on 1/11/2001

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q270589



SYMPTOMS
You have a Visual Basic ActiveX DLL that has a method that takes an array of Scripting Dictionary Objects as an argument. It may work fine when your Visual Basic client is run in the Visual Basic integrated development environment (IDE) by using this method, but when you run it as a compiled application, you get the following run-time error message:

Run-time error '-2147417848 (80010108)':

Method '~' of object '~' failed

This only occurs when you use late binding to call the method.



RESOLUTION
Use early binding to work around the problem.



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



Steps to Create Server
 Create an ActiveX DLL project with Visual Basic. Class1 is created by default. Change the project name to MyServer. On the Project menu, select References, select Microsoft Scripting Runtime, and then click OK.  Copy the following code into Class1: Option Explicit

Public Function Test(ByVal strName As String, objContentsDic As Dictionary) As String Test = strName End Function  Save and compile the project. MyServer.dll is generated and automatically registered.</ol>

Steps to Create Visual Basic Client
<ol> Create a Standard EXE project with Visual Basic. Form1 is created by default.</li> On the Project menu, select References, select Microsoft Scripting Runtime, and then click OK.</li> Add a Command Button to Form1.</li>  Add the following code to Form1: Option Explicit

Private Sub Command1_Click Dim arrDict(1 To 3) As Dictionary Dim strReturn As String Dim obj As Object Dim x As Integer For x = 1 To 3 Set arrDict(x) = New Dictionary arrDict(x).Add &quot;DicElement&quot; & x, x   Next Set obj = CreateObject(&quot;MyServer.Class1&quot;) strReturn = obj.Test(&quot;test it&quot;, arrDict) MsgBox strReturn End Sub </li> Press the F5 key to run the project, and then click the Command Button. You may see a message box displaying the words:

test it

or else you see the following error message:

Run-time error '-2147417848 (80010108)':

Method 'Test' of object '_Class1' failed

</li> Compile the project into project1.exe. Double-click project1.exe in the Windows explorer to run it. Click the Command Button and note the following error message:

Run-time error '-2147417848 (80010108)':

Method '~' of object '~' failed

</li> Return to the Visual Basic IDE for the client application.</li> On the Project menu, select References, select MyServer.dll, and then click OK.</li>  Change the following code line Dim obj As Object to be this code line: Dim obj As MyServer.Class1 This change ensures that early binding is used. </li> Compile the project, run it again, and note that it works as expected.</li></ol>

Additional query words: -2147417848 80010108 project1 myserver

Keywords: kbbug kbpending KB270589

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.