Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:15:28+00:00 2026-06-11T15:15:28+00:00

How can I add an arraylist attribute into a class using classic ASP? My

  • 0

How can I add an arraylist attribute into a class using classic ASP?

My Example (Not working):

Class AA
    Public AA_id
    Dim data: set data = CreateObject("System.Collections.ArrayList")
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:15:29+00:00Added an answer on June 11, 2026 at 3:15 pm

    You need to initialize class members inside a method – function, sub routine of the class constructor. Naturally, the best of these is inside the constructor.

    Fully working code demonstrating how to use the .NET ArrayList as part of custom VBScript class:

    <%
    Class MyCustomClass
        Private internalArrayList
    
        Private Sub Class_Initialize()  
            Set internalArrayList = Server.CreateObject("System.Collections.ArrayList")
        End Sub  
    
        Private Sub Class_Terminate()  
            Set internalArrayList = Nothing
        End Sub  
    
        Public Sub AddItem(oItem)
            internalArrayList.Add(oItem)
        End Sub
    
        Public Function ToString()
            Dim data, x
            data = "List contains " & internalArrayList.Count & " item"
            If internalArrayList.Count<>1 Then data = data & "s"
            For x=0 To internalArrayList.Count-1
                data = data & "<br />"
                If IsObject(internalArrayList(x)) Then
                    data = data & "complex object of type " & TypeName(internalArrayList(x))
                ElseIf IsArray(internalArrayList(x)) Then
                    data = data & "array with " & (UBound(internalArrayList(x)) + 1) & " items"
                Else  
                    data = data & internalArrayList(x)
                End If
            Next
            ToString = data
        End Function
    End Class
    %>
    

    Usage sample, including adding a complex object:

    Class Foo
        Public Dummy
    End Class
    
    Dim myInstance, myFoo
    Set myInstance = New MyCustomClass
    myInstance.AddItem("hello")
    myInstance.AddItem("world")
    myInstance.AddItem(Array(1, 2, 3))
    
    Set myFoo = New Foo
    myFoo.Dummy = "just checking"
    myInstance.AddItem(myFoo)
    
    Response.Write(myInstance.ToString())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with ArrayList in C# and I am wondering how I can add
I'm having a hard time figuring out how i can add an arraylist into
We can add an image to an photo album using UIImage *img = [UIImage
While we can add Inline Images in paragraphs there does not appear to be
I know one can add event listener for window.error. However when working with Iframes,
can i add arraylist to cookies ? If yes how can i do it
I can add and remove the last line in my dynamic form and calculate
I can add a normal rightBarButton to my navigation without a problem but now
I can add a Conditional statement to a breakpoint, for instance arg0.startsWith(something) but i'd
Can someone please direct me on how I can add something similar to inputAccessoryView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.