VB.NET & For Each Next - For Each Next : Repeats a group of statements for each element in a collection.
ShotDev Focus:
- VB.NET & For Each Next
Syntax
For Each element [ As datatype ] In group [ statements ] [ Continue For ] [ statements ] [ Exit For ] [ statements ] Next [ element ]
Example
AspNetForEach.aspx
<%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim arrData(3) Dim arr As String arrData(0) = "a" arrData(1) = "b" arrData(2) = "c" arrData(3) = "d" For Each arr in arrData Response.write(arr & "<br>") Next End Sub </script>
Screenshot