Sharing is Cool...!!!

Teknologi, Tips & Trick, ilmu, Games, Movies, dan TUGAS KAMPUS saya...

Minggu, 09 Desember 2012

Contoh Source Code Visual Studio 2008

Public Class Form1

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub


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

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim I As Integer
        ListBox1.Items.Clear()
        For I = Val(TextBox1.Text) To Val(TextBox2.Text)
            ListBox1.Items.Add(I)
        Next
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim I As Integer
        ListBox1.Items.Clear()
        For I = Val(TextBox1.Text) To Val(TextBox2.Text)
            If I Mod 2 = 0 Then
                ListBox1.Items.Add("Bil Genap " & I)
            Else
                ListBox1.Items.Add("Bil Ganjil " & I)
            End If
            ListBox1.Items.Add(I)
        Next
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim I As Integer
        ListBox1.Items.Clear()
        For I = Val(TextBox1.Text) To Val(TextBox2.Text)
            If I Mod 3 = 0 And I Mod 2 = 0 Then
                ListBox1.Items.Add(I * -1)
            Else
                If I Mod 3 = 0 Then
                    ListBox1.Items.Add(I)
                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 = 1
        ListBox1.Items.Clear()

        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
        ListBox1.Items.Clear()
        I = Val(TextBox1.Text)
        Do While I <= Val(TextBox2.Text)
            ListBox1.Items.Add(I)
            I = I + 1
        Loop
    End Sub

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

    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim I As Integer
        ListBox1.Items.Clear()
        I = Val(TextBox1.Text)
        Do While I <= Val(TextBox2.Text)
            If I Mod 3 = 0 And I Mod 2 = 0 Then
                ListBox1.Items.Add(I * -1)
            Else
                If I Mod 3 = 0 Then
                    ListBox1.Items.Add(I)
                End If
            End If

            I = I + 1
        Loop
    End Sub
End Class

Tidak ada komentar: