Minggu, 27 Maret 2011

Looping bagian 4

Pengulangan atau Looping 

Kemudian kita isi perintah dalam program :
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        ListBox1.Items.Clear()
        ListBox2.Items.Clear()
        ListBox3.Items.Clear()

        For i = 2 To Val(TextBox1.Text)
            ListBox1.Items.Add("*" + i.ToString + "," + (i + 1).ToString)
        Next

        For i = 1 To Val(TextBox1.Text)
            If i Mod 4 Then
                ListBox2.Items.Add(i)
            End If
        Next

        For i = 1 To Val(TextBox1.Text)
            If i Mod 3 = 2 Then
                ListBox3.Items.Add(i)
            End If
        Next
    End Sub
End Class

Tidak ada komentar:

Posting Komentar