I'm not sure what you mean. In collections, why order of elements matter? Maybe instead, you need to use Object[] data type?
This doesn't work; MyCollection[999] however, these works; MyCollection["999"] and Dim ii as Integer = 999 MyCollection[ii] So, you don't have to convert variables to string. At least if you use binary collections... Jussi 2009/6/9 Ricardo Díaz Martín <[email protected]>: > Maybe the problem is key in collection are String and you are using > MyCollection(999). > > Try: > > MyCollection("999") > > to get reference to this element. In adition, when you are adding > elements to MyCollection, convert the key to string > (MyCollection.Add(element, CString(ElementKey)) > > regards > Ricardo > > -----Mensaje original----- > De: richard terry <[email protected]> > Reply-to: richard terry <[email protected]>, mailing list for gambas > users <[email protected]> > Para: mailing list for gambas users <[email protected]> > Asunto: [Gambas-user] collection syntax difficulty > Fecha: Tue, 9 Jun 2009 20:39:17 +1000 > > > Gambas DOC: Returns the key of the last read or last enumerated element. > > > I'm having problem reading the key of a collection with collection.key. I > guess gambas is behaving as gambas says it will, however it would be nice to > be able to get the first key in a collection without having to iterate > through it (ie having the default action of collection.key to return the > first key). > > Lets say I have a collection called myCollection which I've loaded with > database information keyed on the primary key of the table. > > Mycollection(999) > > If try and get the key of this by this syntax: > print Mycollection.key > then the key is null > > If I do either > With Mycollection > print Mycollection.key > next > or > > For each Mycollection > print Mycollection.key > next > > then it prints the key (here 999) > > So my question, short of iterating through a collection (even if only one > member) is there no way to get the key of the collection? Docs I guess say > not, is this fixable/changeable? > > Richard > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
