PRB: "For Each" Behavior on Dynamically Changing Control ArrayLast reviewed: December 13, 1996Article ID: Q129450 |
The information in this article applies to:
SYMPTOMSWhen using "For Each" to iterate through the elements of a control array that changes dynamically during the execution of the loop, the following unexpected behavior may occur:
CAUSEThe set of items (to be iterated over by the For Each) is set at the beginning of the iteration. Items added or deleted during the iteration do not affect the set of items iterated over.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
This is Command1(0) This is Command1(1) Control array element '2' doesn't exist This is Command1(3)Note that attempting to access Command1(2) generates an error because it is unloaded at the first iteration of the loop, and that Command1(4) is not printed.
|
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |