PERTEMUAN KE 2 DAN 3
Agenda : Membuat Form yang berisi LOOPING , DO , WHILE
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim I As Integer = I
ListBox1.Items.Clear()
I = Val(TextBox2.Text)
Do While I <= Val(TextBox3.Text)
If I Mod 3 = 0 And I Mod 2 = 0 Then
ListBox1.Items.Add(I * -1)
Else
If I Mod 3 = 0 Then
ListBox1.Items.Add(I)
End If
End If
I = I + 1
Loop
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim I As Integer
ListBox1.Items.Clear()
For I = 1 To 10
ListBox1.Items.Add(I)
Next
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim I As Integer
ListBox1.Items.Clear()
For I = Val(TextBox2.Text) To Val(TextBox3.Text)
ListBox1.Items.Add(I)
Next
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim I As Integer
ListBox1.Items.Clear()
For I = Val(TextBox2.Text) To Val(TextBox3.Text)
If I Mod 3 = 0 And I Mod 2 = 0 Then
ListBox1.Items.Add(I * -1)
Else
If I Mod 3 = 0 Then
ListBox1.Items.Add(I)
End If
End If
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim I As Integer = I
ListBox1.Items.Clear()
Do While I <= 10
ListBox1.Items.Add(I)
I = I + 1
Loop
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim I As Integer = I
ListBox1.Items.Clear()
I = Val(TextBox2.Text)
Do While I <= Val(TextBox3.Text)
ListBox1.Items.Add(I)
I = I + 1
Loop
End Sub
End Class
Tidak ada komentar:
Posting Komentar