Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1779
| From | Michael Cole <invalid@microsoft.com> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: VB6 use of For Each with Collections |
| Date | 2013-05-08 11:48 +1000 |
| Organization | A noiseless patient Spider |
| Message-ID | <kmcamg$bgs$1@dont-email.me> (permalink) |
| References | <e741101c-d3c7-4193-9fb3-b5543f9d33f6@googlegroups.com> <tg6jo85e8g9pfkiintb6as2f306fuvks21@4ax.com> |
ralph was thinking very hard : > On Tue, 7 May 2013 14:22:36 -0700 (PDT), stevegdula@yahoo.com wrote: > > >> I can't seem to see a way to derive the "KEY" value assigned to a member >> of the collection while using the For Each approach. The Default property >> of the collection object is the "ITEM" value. >> >> /snipped >> >> I don't see a way to determine the "KEY" value. Use of the KEY value would >> help me compare one collection to another collection. >> /snipped >> I realize I can enter the KEY value in BOTH the KEY & ITEM entries to get my >> end result, but it doubles the data size of the collection. >> > > As you discovered, you can't, as there is no "Key" property. > > There are various work-arounds using additional arrays or collections, > and mechanisms to combine multiple properties within a single value. > > It sounds like you have explored them. > > [The Scripting Dictionary is another solution, but would require an > outside reference. Dictionaries do seem a tad faster than VB > Collections.] > > The easiest way, and my personal preference, is to create your own > Collection and add a Key property, as per CVMichael's suggestion ... > http://www.vbforums.com/showthread.php?423549-RESOLVED-Displaying-the-quot-Key-quot-in-a-Collection Another solution would be to use three standard collections - two for holding the datasets, and one for holding the list of dataset field names from both. Then go through the field names collection in sequence, and for every field name, compare the items in the two dataset collections. I can explain this better if it is not clear. -- Michael Cole
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
VB6 use of For Each with Collections stevegdula@yahoo.com - 2013-05-07 14:22 -0700
Re: VB6 use of For Each with Collections Michael Cole <invalid@microsoft.com> - 2013-05-08 10:21 +1000
Re: VB6 use of For Each with Collections ralph <nt_consulting@yahoo.com> - 2013-05-07 19:39 -0500
Re: VB6 use of For Each with Collections Michael Cole <invalid@microsoft.com> - 2013-05-08 11:48 +1000
Re: VB6 use of For Each with Collections GS <gs@somewhere.net> - 2013-05-07 23:55 -0400
Re: VB6 use of For Each with Collections Deanna Earley <dee.earley@icode.co.uk> - 2013-05-08 09:19 +0100
Re: VB6 use of For Each with Collections stevegdula@yahoo.com - 2013-05-08 08:27 -0700
Re: VB6 use of For Each with Collections ralph <nt_consulting@yahoo.com> - 2013-05-08 11:25 -0500
Re: VB6 use of For Each with Collections ralph <nt_consulting@yahoo.com> - 2013-05-08 11:52 -0500
Re: VB6 use of For Each with Collections stevegdula@yahoo.com - 2013-05-08 12:00 -0700
Re: VB6 use of For Each with Collections "Eduardo" <mm@mm.com> - 2013-06-30 22:48 -0300
Re: VB6 use of For Each with Collections ralph <nt_consulting@yahoo.com> - 2013-06-30 22:09 -0500
Re: VB6 use of For Each with Collections Schmidt <ng@vbRichClient.com> - 2013-07-01 07:58 +0200
Re: VB6 use of For Each with Collections "Eduardo" <mm@mm.com> - 2013-07-01 03:47 -0300
Re: VB6 use of For Each with Collections "Eduardo" <mm@mm.com> - 2013-07-01 04:08 -0300
Re: VB6 use of For Each with Collections "Eduardo" <mm@mm.com> - 2013-07-01 04:01 -0300
Re: VB6 use of For Each with Collections vincent.belaiche@gmail.com (Vincent Belaïche) - 2013-07-05 06:30 +0200
Re: VB6 use of For Each with Collections "Eduardo" <mm@mm.com> - 2013-07-05 03:31 -0300
csiph-web