Latihan Perulangan

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()
        Dim x As Byte
        x = 1
        Do Until x = 10

            ListBox1.Items.Add(x)
            x = x + 1
        Loop
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox2.Items.Clear()
        Dim z As Byte
        z = 1
        Do While z <= 10
            ListBox2.Items.Add(z)
            z = z + 1
        Loop
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox3.Items.Clear()
        Dim y As Byte
        For y = 1 To 5
            ListBox3.Items.Add(y)
        Next y
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        ListBox4.Items.Clear()
        For j = 1 To 5
            ListBox4.Items.Add("STMIK")
        Next
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        ListBox5.Items.Clear()
        Dim a As Integer
        Do Until a = 5
            ListBox5.Items.Add("STMIK")
            TextBox1.Text = TextBox1.Text & "STMIK"
            a = a + 1
        Loop
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        ListBox6.Items.Clear()
        Dim a As Integer
        For a = 0 To 20 Step 5
            ListBox6.Items.Add(a)
            TextBox2.Text = TextBox2.Text & a
        Next
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        ListBox7.Items.Clear()
        Dim a As Integer
        For a = 20 To 0 Step -5
            ListBox7.Items.Add(a)
            TextBox3.Text = TextBox3.Text & a
        Next
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


  

Share this

Related Posts

Previous
Next Post »

Terimakasih Atas Komentar Anda....!!! :) EmoticonEmoticon