|
-
Aug 6th, 2002, 04:00 AM
#1
Thread Starter
Hyperactive Member
Collection of Controls... what order does For Each follow?
It seems that when I loop through the controls on a form using For Each, that they are processed in the reverse order from which they were placed on the form. This seems to be the case even if I change the tab order manually.
Can anyone confirm this? Can one rely on this sequence always being the case?
Ciao,
-
Aug 6th, 2002, 04:10 AM
#2
Well ...
I wouldn't go by the order. If I required a specific order I would either use an array or write some routine to sort a collection the way I want.
Is there a specific reason you want this collection to be ordered a particular way?
.
-
Aug 6th, 2002, 04:17 AM
#3
Retired VBF Adm1nistrator
Re: Collection of Controls... what order does For Each follow?
Originally posted by Jim Brown
It seems that when I loop through the controls on a form using For Each, that they are processed in the reverse order from which they were placed on the form. This seems to be the case even if I change the tab order manually.
Can anyone confirm this? Can one rely on this sequence always being the case?
Ciao,
Hmmm I would agree that it appears to be in reverse order.
But as you know, you can never assume anything when writing release-edition software
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Aug 6th, 2002, 04:51 AM
#4
Thread Starter
Hyperactive Member
Re: Well ...
Originally posted by honeybee
Is there a specific reason you want this collection to be ordered a particular way?
.
No not really! I just noticed in a debug.print that it seems to be that way and wondered if one could rely on that.
This reminds me of a situation we had some years back with a proprietary print program. It ran on 2 platforms, a DEC Mini and an IBM mainframe and they built more features in the IBM version on account of having more bang. Most of us knew the differences.
Bobby had only ever been trained on the m/f version, but one day needed to code on the DEC. He used a feature he had always used on the IBM, and all was well.
Then one day a new version of the DEC version came out and his code fell over. Turned out the feature he had used on the DEC was a m/f only feature but had worked on the DEC by default or oversight or whatever. When it was taken out, they said it was never there according to the (DEC version) manual, and he shouldn't have used it in the first place.
Your mileage may vary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|