storing vbscript classes in an an array

Results 1 to 2 of 2

Thread: storing vbscript classes in an an array

  1. #1
    Join Date
    Dec 1969

    Default storing vbscript classes in an an array

    Is this doable?<BR>I want to have something like the following<BR>Dim myArray(10)<BR>set sc1=new SomeClass<BR>myArray(0)=sc1<BR>etc..<BR><BR><BR>fo r i=0 to ubound(myArray)<BR><BR> set myobject=myArray(i)<BR> myobject.DisplayMe<BR>next<BR><BR><BR>Class SomeClass<BR> public sub DisplayMe<BR> Response.write("hello from SomeClass")<BR> end sub<BR>End Class<BR><BR>I&#039;ve kind of achieved this with dictionary but i&#039;m not sure if<BR>thats a good thing to do, since my code will be run fairly frequently.<BR>So the questions are:<BR>Can i acheive the above with an array as shown?<BR>if not is using a dictionary a viable solution&#062;?

  2. #2
    Join Date
    Dec 1969

    Default Why didn't you try it?

    If you can do it with a dictionary, you can *certainly* do it with an array.<BR><BR>However, the title of your post is wrong: You are storing *INSTANCE* of VBS classes in your array/dictionary. There&#039;s no way to store a *CLASS*, per se, anyplace but in an ".asp" (or ".vbs") file, using VBScript.<BR><BR>I should warn you that no matter how you store instances, you can NOT then store them into a Session or Application variable and expect to retrieve them in another page. Just plain won&#039;t work, unfortunately.<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts