Pages

Senin, 14 Maret 2011

Penggunaan for do, do while dan memanggil module

Penggunaan for do, do while dan memanggil module











gambar form secara jelas
















source codenya :
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim j, v, y As Integer
        v = 4
        y = 7
        For j = 4 To Val(TextBox1.Text)
            If j Mod v = 0 Then
                ListBox1.Items.Add(j)
                v = j
            Else
                If j Mod y = 0 Then
                    ListBox1.Items.Add(j * -1)
                    y = j
                End If
            End If
        Next
    End Sub

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

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim i As Integer
        For i = 1 To Val(TextBox1.Text)
            If i Mod 2 = 0 Then
                ListBox1.Items.Add(i)
            Else
                ListBox1.Items.Add(i * -1)
            End If
        Next
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Call tampilnama()
        TextBox2.Text = nama

    End Sub
End Class


desain pada module :
















source code pada module :















 memanggil module:

0 komentar:

Posting Komentar