[Gambas-user] Collections bug? Referencing from variable.
webmaster at ...664...
webmaster at ...664...
Fri Nov 5 12:49:21 CET 2004
Yea I meant string, not integer.
MyCollection["NAME"] works
Dim CheckVal as String
CheckVal = "NAME"
MyCollection[CheckVal] doesn't.
Collections probably aren't the best way of doing this. I just need a way of
storing configuration data where I can refer to any of the elements by a name
(2 Fields - Name and Value. Lookup name by a string and return its value) If
there is a better way of doing this without a physical DB that would be
usefull =)
Tonight i'll lookup the precise error, but thats about the jist of it.
Benoit Minisini <gambas at ...1...> wrote:
> On Monday 01 November 2004 21:01, webmaster at ...664... wrote:
> > Hey all - Quite an annoying little problem. It seems I can't access an
> > element in a collection from a index stored in a variable.
> >
> > This code sample probably isn't accurate, i'm just typing it into my mail
> > client...
> >
> > Function Test (VarIndex as integer) as string
> > Return MyCollection[VarIndex]
> > End Function
> >
> > You get the idea what I want to do?
> >
> > While im here, is there anything in gambas that behaves like ADO
> > recordsets? Just something that gives the ability of a multidimensional
> > array with searching? Thanks
> >
>
> Collection elements are indexed by a string, not an integer. The Gambas
> collections are not the same as VB collections - I didn't want to waste CPU
> and memory.
>
> Regards,
More information about the User
mailing list