Re: Newbie Question: Classes and Arrays by Blue
Blue
Tue Jan 30 14:12:08 CST 2007
On Jan 30, 1:28 am, "Al Dunbar [MS-MVP]" <alan-no-drub-
s...@hotmail.com> wrote:
> "Blue Streak" <rdlebre...@hotmail.com> wrote in message
>
> news:1170114587.061293.33060@v45g2000cwv.googlegroups.com...
>
>
>
>
>
> > Hi, Folks!
>
> > Let say I have a class like:
>
> > Class clsMyClass
> > Public iNumber
> > Public szQuestion
> > Public szResponse
> > End Class
>
> > How can I extend this:
> > Dim myTest : Set myTest = New clsMyClass
>
> > ...into anarray?
>
> > Would it be like:
> > Dim myTest(2) : Set myTest =Array(New clsMyClass, New clsMyClass, New
> > clsMyClass)
>
> > How could you do this dynamically?
>
> The above is a type mismatch, as thearrayfunction returns anarrayrather
> than the object that is expect by the SET statement. If you explicitly
> DIMension yourarray, I think you would need to assign object values to each
> element like this:
>
> myTest(0) = new clsMyClass
> myTest(1) = new clsMyClass
> myTest(2) = new clsMyClass
>
> or in a loop.
>
> If you want the simplicity of using theArrayfunction, just lost the
> dimension from the DIM statement and lost the SET:
>
> dim myTest : myTest =Array(New clsMyClass, New clsMyClass, New
> clsMyClass)
>
> /Al- Hide quoted text -
>
> - Show quoted text -
I will try that, Thx
Obviously, this cannot be done dynamically.