Welcome to my blog, hope you enjoy reading
RSS

home

Selasa, 09 April 2013

Program Kontrol Perulangan pada VB NET


Public Class Form1
    Dim a As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()
        For a = 1 To 100
            ListBox1.Items.Add(a)
        Next
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        For a = 100 To 1 Step -2
            ListBox1.Items.Add(a)
        Next
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Clear()
        a = Asc("A")
        Do Until a > Asc("Z")
            ListBox1.Items.Add("huruf :" & Chr(a))
            a = a + 1
        Loop
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        ListBox1.Items.Clear()
        a = Asc("Z")
        Do While a >= Asc("A")
            ListBox1.Items.Add("huruf :" & Chr(a))
            a = a - 1
        Loop
    End Sub
End Class


HASIL:






0 komentar:

Posting Komentar