Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

Using FOR EACH Loop in VB


Using FOR EACH Loop in VB helps to repeat a group of statements for each statement in a collection.

FOR EACH loop usually using when you have execute every single item of a sentence. ie, element in an array, element in a file or element in a string.

  • Item – Item in the group
  • Group –Group containing items
  • statement to execute – Statement which you want to execute.

Mainly used loops in VB.NET:

FOR NEXT Loop

FOR EACH Loop

WHILE Loop

DO WHILE Loop

FOR EACH Loop

Using FOR EACH Loop in VBComplete Code

Using FOR EACH Loop in VBWorking

  • Step 1: Assign “Welcome to VB World” to the string variable.

  • Step 2: SingleChar will extract each character from the given string.
  • Step 3: Executing body, where you get the result through the messagebox.

Nested Loops - FOR EACH Loop in VB

  • Nested Loops helps to nest FOR EACH by putting other loop inside another.

Nested Loops – Complete Code

  • When you nest loops, each loop must have a unique element variable.

Exit For and Continue For - FOR EACH Loop in VB

  • The Exit For statement is used to exit the execution of the code inside the For Each Statement.
  • The Continue For statement transfers control immediately to the next iteration of the loop

Exit For and Continue For – Complete Code

 Using FOR EACH 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="">