[Gambas-user] Not an Object (Collection)

John Dovey dovey.john at gmail.com
Sun Jun 20 03:52:57 CEST 2021


>  I think you want WorkCmd.Exist("BoneDate").
100% correct. Thank you!


On Sat, 19 Jun 2021 at 17:13, Tobias Boege via User <
user at lists.gambas-basic.org> wrote:

> On Sat, 19 Jun 2021, John Dovey wrote:
> > Hi,
> > I define a collection and later add a value to it:
> >
> > Dim WorkCmd As New Collection ' Leaving out the "new" makes no difference
> > '...
> > WorkCmd.Add(Date(Now), "BoneDate")
> >
> >
> > When I try to check for an existing key, it tells me it's "Not an Object"
> > Print "Date: ", WorkCmd["BoneDate"] ' <-- This works
> > Print  WorkCmd["BoneDate"] '<-- This works
> > Print WorkCmd["BoneDate"].Exist '<-- This doesn't
> > If Print  WorkCmd["BoneDate"].exist then '<-- This gives the same error
> >
>
> You're retrieving the value at "BoneDate" and call the Exist method
> on that value. Given that you stored a Date value in there, which is
> not an object, the error is justified. A Date value has no "Exist"
> method.
>
> I think you want WorkCmd.Exist("BoneDate").
>
> Best,
> Tobias
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210619/70a779ea/attachment.htm>


More information about the User mailing list