for loop

For Loops statement, which allows code to be repeatedly executed. In ASP.NET programming sometimes you have to faces situation to repeat a task for several times or you have to repeat a task till you reach a condition, in these situations you can use loop statements to achieve your desired results.

In VB.NET the FOR NEXT Loop , execute the loop body (the source code within For ..Next code block) to a fixed number of times.


  1. var : The counter for the loop to repeat the steps.
  2. starValue : The starting value assign to counter variable .
  3. endValue : When the counter variable reach end value the Loop will stop .
  4. loopBody : The source code between loop body


  1. initialization : Initialize the value of variable.
  2. condition : Evaluate the condition
  3. step : Step taken for each execution of loop body

The following ASP.NET example declare two variables startVal and maxVal and then assign the values 1 and 10 respectively and display the number 1 to 10 using for loop.


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.vb (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About