Hi there are two options I see why it's not working. One is, as you assumed,
declaration of a 2d array: In my knowledge it has to be done this way:
dim arS
reDim arS(2)

The second thing is indexing: Arrays don't start at 0, but instead at 1, so
arS(2)="name" is a valid statement.

Have fun, Jure

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 11, 2004 1:57 AM
Subject: [wdvltalk] ASP Arrays OO


> Hi, I'm having a problem with accessing the elements of an array which is
> a property of a user defined class.  Here's the class:
> =====================================
> Class clsCart
>
> '_____________Instance Variables____
>
> Private cvIntID
> Private cvArrItems
> Private cvObjData
>
>
> '____________Property Lets and Gets

>
> '1___________ID__________
> Public Property Let ID(Param)
> cvIntID = Param
> End Property
>
> Public Property Get ID
> ID = cvIntID
> End Property
>
> '2___________Items__________
> Public Property Let Items(Param)
> cvArrItems = Param
> End Property
>
> Public Property Get Items
> Items = cvArrItems
> End Property
>
> '3___________Data__________
> Public Property Get data
> if not isObject(cvObjData) Then
> set cvObjData = new clsDataAccess
> end if
> set Data = cvObjData
> End Property
>
> ' Class Methods Will Go Here...
> End Class
> =====================================
>
> I then instantiate the class (gvobjCart), get a recordset of product data
> and assign the recordset to the Items property of the object using
> GetRows().
> gvobjCart.Items = dbRS.GetRows()
>
> I am then assuming (dangerous, I know) that Items is a 2 dimensional array
> (isArray() returns true).  So far so good.  I can loop through the Items
> array using a For Each loop and it contains the correct data.
>
> BUT, if i try to response.write gvobjCart.Items(0,0) (which should contain
> the ID of the first Product) I get the error "Wrong number of arguments or
> invalid property assignment: 'Items'".
>
> If I skip the OO part and just assign the recordset to a variable eg.
> arrCart = dbRS.GetRows() then response.write arrCart(0,0) seems to work
> fine.
>
> So... do I need to explicitly define the Items variable in the class as an
> array - or something like that?  I've played around with this and can't
> get it to work.  I wouldn't have thought that was the answer anyway as the
> recordset gets assigned to gvobjCart.Items as an array with no problem.
>
> Any help much appreciated.
>
> Cheers,
>
> Clancy
>
> ____ ? The WDVL Discussion List from WDVL.COM ? ____
> To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
>        Send Your Posts To: [EMAIL PROTECTED]
> To set a personal password send an email to [EMAIL PROTECTED] with the
words: "set WDVLTALK pw=yourpassword" in the body of the email.
> To change subscription settings to the wdvltalk digest version:
>     http://wdvl.internet.com/WDVL/Forum/#sub
>
> ________________  http://www.wdvl.com  _______________________
>
> You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to %%email.unsub%%
>
> To unsubscribe via postal mail, please contact us at:
> Jupitermedia Corp.
> Attn: Discussion List Management
> 475 Park Avenue South
> New York, NY 10016
>
> Please include the email address which you have been contacted with.
>
>
>




____ ? The WDVL Discussion List from WDVL.COM ? ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to