Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

Using FOR NEXT loop in VB


  • This program explains how to use FOR NEXT loop in VB programming.
  • FOR NEXT allows us to run one or more lines of code repeatedly without any break. FOR NEXT loop will break if the condition that you are given become false, otherwise it will continue.
This program explains how to use FOR NEXT loop in VB programming.

This program explains how to use FOR NEXT loop in VB programming.

Mainly used loops in VB.NET:

FOR NEXT Loop

FOR EACH Loop

WHILE Loop

DO WHILE Loop

FOR EACH Loop

  • In FOR NEXT Loop, your desired code must be inside FOR ….NEXT Statement.
  • Syntax for FOR NEXT Loop

  • Counter – Numeric value or counter for repeating the loop.

  • Start To End – Value from where the loop starts and from which value it stops running loop.

Using FOR NEXT loop in VB  - Complete Code

Using FOR NEXT loop in VB Working

  • Step 1: You have to declare Counter, StartValue, EndValue as integer
  • Step 2: Set StartValue as 1 (here you set the value where counter starts)
  • Step 3: Set EndValue as 10 (Here you set the value where the loop stops)
  • Step 4: Assign the StartValue to the counter and starts loop until the counter reaches the EndValue.
  • Step 5: Executing the loop body, till the counter reaches end and finally loops out.

EXIT Function

  • You can use EXIT function inside the loop. It helps to exit the loop under certain condition before the counter comes to EndValue.

Using FOR NEXT loop in VB


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">