Presented By:

         Name : Abhishek Pachisia
         Course : B.Tech-IT(Sem V)
         Roll No. : 090102801
Made By: Abhishek Pachisia           1
What is VB.NET?

•It is simply Visual Basic for .NET platform developed
by Microsoft.

•It has more components and control than Visual Basic


           Made By: Abhishek Pachisia                    2
Visual Basic loop structures allow to run one or
more lines of code repetitively

Statements in a loop structure can be repeated

   Until a condition is True
   Until a condition is False
   A specified number of times, or
   Once for each element in a collection.
            Made By: Abhishek Pachisia              3
Types of Looping:

There are mainly 3 types of loop:

For Loop

While Loop

Do Loop


            Made By: Abhishek Pachisia   4
• The For loop is the most popular loop.

•For loops enable us to execute a series of expressions
multiple numbers of times.

•Syntax:

        For index=start to end[Step step]
        [statements]
        [Exit For]
        [statements]
        Next[index]

              Made By: Abhishek Pachisia                  5
Example:

    Module Module1

    Sub Main()
    Dim d As Integer
    For d = 0 To 2
    System.Console.WriteLine("In the For Loop")
    Next d
    End Sub

    End Module


           Made By: Abhishek Pachisia             6
•While loop keeps executing until the
condition against which it tests remain true.

•Syntax:

       While condition
      [statements]
      End While


            Made By: Abhishek Pachisia          7
Example:

      Module Module1

       Sub Main()
       Dim d, e As Integer
       d=0
       e=6
       While e > 4
       e -= 1
       d += 1
       End While
       System.Console.WriteLine("The Loop ran " & e &
"times")
       End Sub

      End Module By: Abhishek Pachisia
             Made                                       8
•The Do loop keeps executing it's statements while or until the
condition is true.
•Two keywords, while and until can be used with the do loop.
•The Do loop also supports an Exit Do statement which makes
the loop to exit at any moment.

•Syntax:

       Do[{while | Until} condition]
       [statements]
       [Exit Do]
       [statements]
       Loop

                 Made By: Abhishek Pachisia                       9
Example:

    Module Module1

    Sub Main()
    Dim str As String
    Do Until str = "Cool"
    System.Console.WriteLine("What to do?")
    str = System.Console.ReadLine()
    Loop
    End Sub

    End Module

           Made By: Abhishek Pachisia         10
Made By: Abhishek Pachisia   11

Vb.net (loop structure)

  • 1.
    Presented By: Name : Abhishek Pachisia Course : B.Tech-IT(Sem V) Roll No. : 090102801 Made By: Abhishek Pachisia 1
  • 2.
    What is VB.NET? •Itis simply Visual Basic for .NET platform developed by Microsoft. •It has more components and control than Visual Basic Made By: Abhishek Pachisia 2
  • 3.
    Visual Basic loopstructures allow to run one or more lines of code repetitively Statements in a loop structure can be repeated Until a condition is True Until a condition is False A specified number of times, or Once for each element in a collection. Made By: Abhishek Pachisia 3
  • 4.
    Types of Looping: Thereare mainly 3 types of loop: For Loop While Loop Do Loop Made By: Abhishek Pachisia 4
  • 5.
    • The Forloop is the most popular loop. •For loops enable us to execute a series of expressions multiple numbers of times. •Syntax: For index=start to end[Step step] [statements] [Exit For] [statements] Next[index] Made By: Abhishek Pachisia 5
  • 6.
    Example: Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine("In the For Loop") Next d End Sub End Module Made By: Abhishek Pachisia 6
  • 7.
    •While loop keepsexecuting until the condition against which it tests remain true. •Syntax: While condition [statements] End While Made By: Abhishek Pachisia 7
  • 8.
    Example: Module Module1 Sub Main() Dim d, e As Integer d=0 e=6 While e > 4 e -= 1 d += 1 End While System.Console.WriteLine("The Loop ran " & e & "times") End Sub End Module By: Abhishek Pachisia Made 8
  • 9.
    •The Do loopkeeps executing it's statements while or until the condition is true. •Two keywords, while and until can be used with the do loop. •The Do loop also supports an Exit Do statement which makes the loop to exit at any moment. •Syntax: Do[{while | Until} condition] [statements] [Exit Do] [statements] Loop Made By: Abhishek Pachisia 9
  • 10.
    Example: Module Module1 Sub Main() Dim str As String Do Until str = "Cool" System.Console.WriteLine("What to do?") str = System.Console.ReadLine() Loop End Sub End Module Made By: Abhishek Pachisia 10
  • 11.
    Made By: AbhishekPachisia 11