Latihan VB

Jumat, 04 Maret 2011  | 

Add a Comment  | 




Alhamdulillah akhirnya berhasil juga coba Running VB dirumah, begini nih hasilnya See Up :
 
Source Code :

Public Class Form1

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            ComboBox1.Items.Add(TextBox1.Text)
        End If
    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 = 5 To Val(TextBox2.Text)
            If i Mod 2 = 0 Then
                ListBox1.Items.Add(i * -1)
            Else
                ListBox1.Items.Add(i)
            End If
        Next

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim j, u, y As Integer
        u = 10
        y = 12
        For j = 10 To Val(TextBox2.Text)
            If j Mod u = 0 Then
                ListBox1.Items.Add(j)
                u = j
            Else
                If j Mod y = 0 Then
                    ListBox1.Items.Add(j * -1)
                    y = j
                End If
            End If
        Next
    End Sub
End Class

0 komentar:

Posting Komentar

 
Copyright 2010 | Ruang Singgah: Latihan VB | Template by Nakul Ezhuthupally