title: vbscript - returning object from array via function
body: <p>I've been looking online for a way to make a vbscript function to return an object I created:</p>
  
  <pre><code>&lt;%
  
  dim myArray(5)
  set myArray(5) = new MyClass
  
  for i = 0 to 5
  response.write("i :" &amp; i &amp; "&lt;br/&gt;")
  set myArray(i) = new MyClass
  myArray(i).MyText = "Number " &amp; i
  next
  
  class MyClass
  
      public MyText
  
  End class
  
  function getMyClass(text)
  
      set getMyClass = new MyClass
      getMyClass.MyText = text
  
  end function
  
  
      response.write(getmyclass("Here!").mytext &amp; "&lt;br/&gt;")
  
  function getMyArray(number)
  
      response.write("check: " &amp; myArray(number).MyText &amp; "&lt;br/&gt;")
      set getMyArray = new MyClass
      getMyArray = myArray(number)
  
  end function
  
      response.write(getMyArray(1).mytext)
  
  %&gt;
  </code></pre>
  
  <p>This is the error I'm getting:</p>
  
  <p>Microsoft VBScript runtime error '800a01b6'</p>
  
  <p>Object doesn't support this property or method</p>
  
  <p>/carousel classes/funcarray.asp, line 32</p>
  
  <p>And it refers to the function "getMyArray(number)"</p>