Showing posts with label For Loop. Show all posts
Showing posts with label For Loop. Show all posts

Monday, April 18, 2011

Loop through a DataSet

        Dim dr As DataRow
        Dim dt As DataTable
        dt = DataSetName.Tables(0)
        For Each dr In dt.Rows
           something = dr("FeildName")
        Next

Wednesday, October 27, 2010

The For loop

The For loop is used when the number of repetitions is known. It uses a single variable to start the loop, and indicates how many times the loop needs to execute.

For intCount = 0 To 5
   msgbox("This is loop number " & intCount)

Next


The loop counter variable in this instance is intCount. It begins at 0. Each pass of the loop causes the loop counter to increment +1. The loop will execute 6 time - from 0 to 6.