Rabu, 07 November 2012

LISTBOX


1.    Buat tampilan sepertin ini













Ini codingnya :
Button1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Add(TextBox1.Text)
    End Sub

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

Button 3
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()

    End Sub

Button 4
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        ListBox2.Items.Add(ListBox1.SelectedItem)
       
    End Sub


Button5
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim obj As Object
        obj = ListBox2.SelectedItem

        ListBox2.Items.Remove(obj)


    End Sub

Button6
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim obj As Object
        For Each obj In ListBox1.SelectedItems
            ListBox2.Items.Add(obj)
        Next

    End Sub

Button7
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        ListBox2.Items.AddRange(ListBox1.Items)

    End Sub

Button8
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

        For i As Integer = 0 To ListBox2.SelectedIndices.Count - 1
            ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
        Next
    End Sub

Button9
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        ListBox2.Items.Clear()


    End Sub


Salam SUKSES Untuk KITA Semua !!

Tidak ada komentar:

Posting Komentar