| |
AdmiralGanja
Posts: 6
Score: 0
Joined: 3/11/2007
Status: offline
|
SOLVED Please Help! I need to return a dictionary or array of objects from a function but it does not work. The below works fine if i type Response.Write(getCars()). If I need to return the whole list by changing: From: getCars = CarObject.Item(0).color To: getCars = CarObject.Item(0) it does not work with Response.Write(getCars().color). Why is this? I need to be able to return a dictionary with objects or at least an Array with objects. Thanks in advance! /Jesper Wilfing *** FUNCTION TO RETURN MY DICTIONARY OR ARRAY OF OBJECTS Public Function getCars() Dim CarObject1 Dim CarObject2 Set CarObject1 = new Car Set CarObject2 = new Car Dim CarObject Set CarObject = CreateObject("Scripting.Dictionary") CarObject1.color = "red" CarObject1.brand = "volvo" CarObject.Add 0, CarObject1 CarObject2.color = "purple" CarObject2.brand = "saab" CarObject.Add 1, CarObject2 getCars = CarObject.Item(0).color End Function Response.Write(getCars()) '*** CAR CLASS *** Class Car Private strColor Private strBrand Public Property Let color(ByVal value) strColor = value End Property Public Property Get color color = strColor End Property Public Property Let brand(ByVal value) strBrand = value End Property Public Property Get brand brand = strBrand End Property End class
< Message edited by AdmiralGanja -- 4/17/2007 1:05:38 AM >
|
|