DOC: For Each ... Next Statement Does Not Work for Collections

ID: Q180487


The information in this article applies to:
  • Microsoft Windows CE Toolkit for Visual Basic 6.0
  • Microsoft Windows CE Toolkit for Visual Basic 5.0, version 1.0


SUMMARY

In the Help topics for the Microsoft Windows CE Toolkit for Visual Basic 5.0 (VBCE5) and Microsoft Windows CE Toolkit for Visual Basic 6.0 (VBCE6), the description for the "For Each ... Next" statement is as follows:

"Repeats a group of statements for each element in an array or collection."

However, this is not true for collections because you cannot declare a collection in either VBCE5 or VBCE6.


MORE INFORMATION

Unlike the information presented in Books Online, the following code will not work in either VBCE5 or VBCE6 because neither the Dim statement's As clause nor New clause are supported:


   Private Sub Command1_Click()
      Dim col As New Collection
      Dim vnt
      col.Add "Item1"
      col.Add "Item2"
      col.Add "Item3"
      col.Add "Item4"
      For Each vnt In col
          MsgBox vnt
      Next
   End Sub 

Additional query words: wince vbce vbce5 vbce6

Keywords : kbToolkit kbVBp kbVBp500 kbVBp600 kbWinCE kbWinCE100 kbGrpVB
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 18, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.