The information in this article applies to:
- Microsoft Visual Studio versions 97sp2, 97sp3
SYMPTOMS
 
When using Visual Studio Service Pack 2 or 3, a problem may occur when you
try to work with objects that have been assigned as Visual Basic
collections. When you try to access any of the functions of the collection
(such as count, add, or remove), or use the For...Each...Next enumerations,
the following Visual Basic Script error appears:
   Microsoft VBScript runtime error '800a0030' Error in loading DLL
CAUSE
 
We are researching this bug and will post new information here in the
Microsoft Knowledge Base as it becomes available.
RESOLUTION
 
There are two possible solutions to this problem:
- Revert back to a previous version of Visual Basic 5.0 (prior to Service
   Pack 2).
 
-or-- Implement a class wrapper around the collection object of Visual Basic.
   To implement a class wrapper around the collection object, follow these
   steps:
- Add the following code to a class module in Visual Basic:
       Option Explicit
      Private m_cList As Collection
       'Add
      'Purpose     - Add to list
      'Inputs      - (String)  sKey
      '            - (Variant) vItem
      Public Sub Add(ByVal sKey As String, vItem As Variant)
        m_cList.Add vItem, sKey
      End Sub
      'Remove
      'Purpose     - Remove from list
      'Inputs      - (String)  sKey
      Public Sub Remove(sKey As String)
        m_cList.Remove sKey
      End Sub
      Public Property Get Count() As Long
        Count = m_cList.Count
      End Property
      Public Property Get Item(sKey As String) As Variant
        On Error Resume Next
        If m_cList.Count > 0 Then
          If IsObject(m_cList(sKey)) Then
            Set Item = m_cList(sKey)
          Else
            Item = m_cList(sKey)
          End If
        End If
      End Property
      Public Property Get NewEnum() As IUnknown
        On Error Resume Next
        Set NewEnum = m_cList.[_NewEnum]
      End Property
      Private Sub Class_Initialize()
        On Error Resume Next
        Set m_cList = New Collection
      End Sub
      Private Sub Class_Terminate()
        On Error Resume Next
        Set m_cList = Nothing
      End Sub
- In Visual Basic, under the Tools menu, click Procedure Attributes, click
   Advanced, and select the Item methods Procedure ID as default and select
   the NewEnum procedure Id as -4 (you will need to type this in manually).
- Place this code into a class module for the project. Instead of using a
   collection, use the class module with this code.
- To test this new object, create a test Active Server Page with the
   following code:
   <%
       'Create an instance of the new collection object
      Set objMyColl = Server.CreateObject("Project1.Class1")
       If IsObject(objMyColl) Then
         Response.Write "Yes, I am an object" & "<BR><BR>"
         'Add some test members
         objMyColl.Add CStr("1"), "Apple"
         objMyColl.Add CStr("2"), "Orange"
         objMyColl.Add CStr("3"), "Banana"
         'Get the count of the members
      Response.Write "I have " & objMyColl.Count & " members" & "<BR><BR>"
          Response.Write "The members are: " & "<BR>"
          For Each Item in objMyColl
            Response.Write item & "<BR>"
          Next
       Else
          Response.Write "Server failed to create object."
       End if
   %>
STATUS
 
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
 
Steps to Reproduce Behavior
 
- Create an ActiveX DLL project in Visual Basic 5.0 with Service Pack 2 or
   later.
- Add a class to the project that has a method (function) with a return
   parameter as a collection.
- Compile the project into a DLL.
- Create an Active Server Page that creates an instance of the object and
   accesses any methods of the object or tries to enumerate the collection.
   The Active Server Page returns the following error:
       Microsoft VBScript runtime error '800a0030' Error in Loading DLL
 
Keywords          : VSGenIss
Version           : WINDOWS:97sp2,97sp3
Platform          : WINDOWS
Issue type        : kbprb