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



The information in this article applies to:

  • Microsoft eMbedded Visual Basic 3.0

This article was previously published under Q265750

SUMMARY

In the Help topics for eMbedded Visual Basic 3.0 (eVB), the description for the For Each ... Next statement is as follows:

"For Each...Next
This statement repeats a block of statements for each element in an array or collection."

However, this is not true for collections because you cannot declare a collection in eVB.

MORE INFORMATION

Unlike the information presented in the eVB online help, the following code does not work in eVB because the New clause is not 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
				
Running this code generates the following compile error message:
The new keyword is not supported for Windows CE.

Modification Type:MajorLast Reviewed:9/4/2002
Keywords:kbbug kbdocerr kbDSupport KB265750