You are on page 1of 8

VALERIO, MARY ANN C.

02BSCE04 BES043

1. DO LOOP - It repeats the enclosed block of statements while a Boolean condition is True or
until the condition becomes True. It could be terminated at any time with the Exit Do
statement.

Example:

Module loops
Sub Main()
' local variable definition
Dim a As Integer = 10
'do loop execution
Do
Console.WriteLine("value of a: {0}", a)
a = a + 1
Loop While (a < 20)
Console.ReadLine()
End Sub
End Module

2. DO UNTIL LOOP- is used when we want to repeat a set of statements as long as the
condition is false. The condition may be checked at the beginning of the loop or at the end of
loop.

Example:

Private Sub Constant_demo_Click()


i = 10
Do Until i>15 'Condition is False.Hence loop will be executed
i = i + 1
msgbox ("The value of i is : " & i)
Loop
End Sub
3. DO LOOP UNTIL LOOP- is used when we want to repeat a set of statements as long as the
condition is false. The Condition may be checked at the beginning of the loop or at the end of
loop.

Example:

<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
i = 10
Do Until i>15 'Condition is False.Hence loop will be
executed
i = i + 1
Document.write("The value of i is : " & i)
Document.write("<br></br>")
Loop

</script>
</body>
</html>

4. DO WHILE LOOP- is used when we want to repeat a set of statements as long as the condition
is true. The condition may be checked at the beginning of the loop or at the end of the loop.

Example:

Private Sub Constant_demo_Click()


Do While i < 5
i = i + 1
msgbox "The value of i is : " & i
Loop
End Sub
5. NESTED DO LOOPS- VB.Net allows using one loop inside another loop. Following section
shows few examples to illustrate the concept.

Example:

Module loops
Sub Main()
' local variable definition
Dim i, j As Integer
For i = 2 To 100
For j = 2 To i
' if factor found, not prime
If ((i Mod j) = 0) Then
Exit For
End If
Next j
If (j > (i \ j)) Then
Console.WriteLine("{0} is prime", i)
End If
Next i
Console.ReadLine()
End Sub
End Module

6. FOR NEXT LOOPS- It repeats a group of statements a specified number of times and a loop
index counts the number of loop iterations as the loop executes.

Example:

Module loops
Sub Main()
Dim a As Byte
' for loop execution
For a = 10 To 20
Console.WriteLine("value of a: {0}", a)
Next
Console.ReadLine()
End Sub
End Module
7. LIST BOX- represents a Windows control to display a list of items to a user. A user can select
an item from the list. It allows the programmer to add items at design time by using the
properties window or at the runtime.
Example:

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
' Set the caption bar text of the form.
Me.Text = "tutorialspont.com"
ListBox1.Items.Add("Canada")
ListBox1.Items.Add("USA")
ListBox1.Items.Add("UK")
ListBox1.Items.Add("Japan")
ListBox1.Items.Add("Russia")
ListBox1.Items.Add("China")
ListBox1.Items.Add("India")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)


Handles Button1.Click
MsgBox("You have selected " +
ListBox1.SelectedItem.ToString())
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As


EventArgs)
Handles ListBox1.SelectedIndexChanged
Label2.Text = ListBox1.SelectedItem.ToString()
End Sub
End Class

ARRAYS- a kind of data structure that can store a fixed-size sequential collection of elements of the
same type. An array is used to store a collection of data, but it is often more useful to think of an
array as a collection of variables of the same type.

8. POS SYSTEM: Point of sale (POS) system is the spot where your customer makes the payment
for goods or services that are offered by your company. Point of sale systems are systems that
enable the business transaction between the client and the company to be completed. A point of
sale purchase or payment is the specific point in time when a financial transaction takes place
through a POS system.

For example, if you decide to buy two products and take them to the checkout counter, the staff there
would scan the products and create a receipt
VIDAL, JAYSON A.
02BSCE04 BES043

1. DO LOOP - It repeats the enclosed block of statements while a Boolean condition is True
or until the condition becomes True. It could be terminated at any time with the Exit Do
statement.

Example:

Module loops
Sub Main()
' local variable definition
Dim a As Integer = 10
'do loop execution
Do
Console.WriteLine("value of a: {0}", a)
a = a + 1
Loop While (a < 20)
Console.ReadLine()
End Sub
End Module

2. DO UNTIL LOOP- is used when we want to repeat a set of statements as long as the
condition is false. The condition may be checked at the beginning of the loop or at the end
of loop.

Example:

Private Sub Constant_demo_Click()


i = 10
Do Until i>15 'Condition is False.Hence loop will be executed
i = i + 1
msgbox ("The value of i is : " & i)
Loop
End Sub
3. DO LOOP UNTIL LOOP- is used when we want to repeat a set of statements as long as
the condition is false. The Condition may be checked at the beginning of the loop or at the
end of loop.

Example:

<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
i = 10
Do Until i>15 'Condition is False.Hence loop will be
executed
i = i + 1
Document.write("The value of i is : " & i)
Document.write("<br></br>")
Loop

</script>
</body>
</html>

4. DO WHILE LOOP- is used when we want to repeat a set of statements as long as the
condition is true. The condition may be checked at the beginning of the loop or at the end
of the loop.

Example:

Private Sub Constant_demo_Click()


Do While i < 5
i = i + 1
msgbox "The value of i is : " & i
Loop
End Sub
5. NESTED DO LOOPS- VB.Net allows using one loop inside another loop. Following section
shows few examples to illustrate the concept.

Example:

Module loops
Sub Main()
' local variable definition
Dim i, j As Integer
For i = 2 To 100
For j = 2 To i
' if factor found, not prime
If ((i Mod j) = 0) Then
Exit For
End If
Next j
If (j > (i \ j)) Then
Console.WriteLine("{0} is prime", i)
End If
Next i
Console.ReadLine()
End Sub
End Module

6. FOR NEXT LOOPS- It repeats a group of statements a specified number of times and a loop
index counts the number of loop iterations as the loop executes.

Example:

Module loops
Sub Main()
Dim a As Byte
' for loop execution
For a = 10 To 20
Console.WriteLine("value of a: {0}", a)
Next
Console.ReadLine()
End Sub
End Module
7. LIST BOX- represents a Windows control to display a list of items to a user. A user can
select an item from the list. It allows the programmer to add items at design time by using
the properties window or at the runtime.
Example:

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
' Set the caption bar text of the form.
Me.Text = "tutorialspont.com"
ListBox1.Items.Add("Canada")
ListBox1.Items.Add("USA")
ListBox1.Items.Add("UK")
ListBox1.Items.Add("Japan")
ListBox1.Items.Add("Russia")
ListBox1.Items.Add("China")
ListBox1.Items.Add("India")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs)


Handles Button1.Click
MsgBox("You have selected " +
ListBox1.SelectedItem.ToString())
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As


EventArgs)
Handles ListBox1.SelectedIndexChanged
Label2.Text = ListBox1.SelectedItem.ToString()
End Sub
End Class

ARRAYS- a kind of data structure that can store a fixed-size sequential collection of elements of the
same type. An array is used to store a collection of data, but it is often more useful to think of an
array as a collection of variables of the same type.

8. POS SYSTEM: Point of sale (POS) system is the spot where your customer makes the
payment for goods or services that are offered by your company. Point of
sale systems are systems that enable the business transaction between the client and the
company to be completed. A point of sale purchase or payment is the specific point in time
when a financial transaction takes place through a POS system.

For example, if you decide to buy two products and take them to the checkout counter, the staff there
would scan the products and create a receipt

You might also like