Help and Support

PRB: "Error Loading DLL" When Returning User Defined Data Type from VB COM Object

Article ID:224397
Last Review:June 29, 2004
Revision:4.0
This article was previously published under Q224397
On This Page

SYMPTOMS

When returning an Array or Collection of user defined data types (UDTs) from a Visual Basic COM object to Active Server Pages (ASP), the following error may occur:
Microsoft VBScript runtime error '800a0030'
Error Loading DLL: TestMethod

Back to the top

CAUSE

User defined data types are not supported in the current version of ASP.

Back to the top

RESOLUTION

Since ASP does not support UDTs, you can work around this by creating a new class to handle the data in place of the UDT and setting the instancing property to PublicNotCreateable. This will ensure that you can pass the necessary information to and from ASP, as well as that the class cannot be created outside of the DLL.

Back to the top

STATUS

This behavior is by design.

Back to the top

MORE INFORMATION

Steps to Reproduce Behavior

1.Create a Visual Basic ActiveX DLL Project called "VBUDTPrj."
2.Add class module called "VBUDTObj."
3.Define a user defined data type as follows:
     
Public Type TestUDT
   strName as String
   strDept as String  
End Type
						
4.Implement the following method:
Public Function TestMethod()As Variant
  Dim rtnArray(10) As Variant
  Dim intCnt As Integer
  For intCnt = 0 To 9
    Dim udtTestData As TestUDT
    udtTestData.strName = "Name"
    udtTestData.strDept = "Department"
    rtnArray(intCnt) = udtTestData
  Next
  TestMethod = rtnArray
End Function
						
5.Create an ASP Page that calls this Method:
  <%
    Dim objTest, udtArray, udtData
    Set objTest = Server.CreateObject("VBUDTPrj.VBUDTObj")
    udtArray = objTest.TestMethod()
    udtData = udtArray(1)  
    Response.Write( "Name = " & udtData.strName & "<BR>" )
    Response.Write( "Dept = " & udtData.strDept & "<BR>" )
  %>
						
6.Run the ASP page and the following error occurs:
Microsoft VBScript runtime error '800a0030'
Error Loading DLL: TestMethod

Back to the top

REFERENCES

Refer to the TYPE statement in the Visual Basic Documentation.

Back to the top


APPLIES TO
Microsoft Active Server Pages 4.0
Microsoft Visual Basic 5.0 Learning Edition
Microsoft Visual Basic 6.0 Learning Edition
Microsoft Visual Basic 5.0 Professional Edition
Microsoft Visual Basic 6.0 Professional Edition
Microsoft Visual Basic 5.0 Enterprise Edition
Microsoft Visual Basic 6.0 Enterprise Edition
Microsoft Internet Information Server 4.0
Microsoft Internet Information Services 5.0

Back to the top

Keywords: 
kberrmsg kbprb KB224397

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.