Jumat, 11 Januari 2013

PUNGSI PERULANGAN (LOOPING) DENGAN MENGGUNAKAN DO UNTIL - DO WHILE – FOR NEXT – WHILE AND WHILE – MENGURUTKAN ANGKA DARI 0-9 – A-Z – Z-A – TAHUN 1-ETS – KATA PERULANGAN(LOOPING) DARI ATAS KE BAWAH DAN DARI KIRI KE KANAN.



1. Pertama desain terlebih dahulu  form load Perulangan(looping)


2. Kemudian klik 2 x di form load dan listing program ke private sub

Listing Program
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim X As Byte
        ListBox1.Items.Clear()
        X = 1
        Do Until X > 10
            ListBox1.Items.Add(X)
            X += 1
        Loop
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim z As Byte
        ListBox2.Items.Clear()
        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
        Dim y As Byte
        ListBox3.Items.Clear()
        y = 1
        For y = 1 To 10
            ListBox3.Items.Add(y)
        Next
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim b As Byte
        ListBox4.Items.Clear()
        b = 1
        While b <= 10
            ListBox4.Items.Add(b)
            b = b + 1
        End While
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim L As Integer
        ListBox5.Items.Clear()
        For L = 1 To 10
            ListBox5.Items.Add("CINTA")
        Next
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim B As Integer
        For B = 1 To 10
            TextBox1.Text = TextBox1.Text & "CINTA "
        Next
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim C As Byte
        ListBox6.Items.Clear()
        C = 10
        While C >= 1
            ListBox6.Items.Add(C)
            C = C - 1
        End While
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Dim A As Integer
        ListBox7.Items.Clear()
        For A = 65 To 90
            ListBox7.Items.Add(Chr(A))
        Next A
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Dim B As Integer
        ListBox7.Items.Clear()
        B = 90
        For B = 90 To 65 Step -1
            ListBox7.Items.Add(Chr(B))
        Next B
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Dim R As Integer
        ListBox8.Items.Clear()
        For R = 2007 To Year(Now)
            ListBox8.Items.Add(R & "/" & R + 1)
        Next
    End Sub

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

    End Sub
End Class

3. Lalu debug,jadi deh…


Tapi ingat! Listing program atau klik di kotak atau kolom satu persatu untuk listing programnya.

Selamat mencoba…!!!!