Bersepeda with my love, Banjaran 3 Maret 2011

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Bukit Lawe - 3 September 2011

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Dieng with my family, 21 Agustus 2012

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Rabu, 07 November 2012

TUGAS 4

Tugas 4



Buatlah Project baru dengan langkah-langkah sebagai berikut
1. Membuka Aplikasi Visual Basic 2010
2. Klik  Windows Form Application maka akan mucul tampilan seperti berikut
3.  Menampilkan Toolbox yang akan digunakan Untuk memunculkan toolbox, bisa   dimunculkan dari menu bar-view-other windows-tollbox



4. Bentuk Form seperti di bawah ini dengan menggunakan komponen toolbox di atas








Keterangan:

5. Double click pada design form lalu copy paste listing Program di bawah ini :
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.SelectionMode = SelectionMode.MultiExtended 
        ListBox2.SelectionMode = SelectionMode.MultiExtended
    End Sub

    Private Sub btisi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btisi.Click
        If TextBox1.Text = "" Then
            MsgBox("di isi disit textbox'e ", vbCritical, "Pesan")
            TextBox1.Focus()
        Else
            ListBox1.Items.Add(TextBox1.Text)
            TextBox1.Text = ""
            TextBox1.Focus()
        End If
    End Sub
    Private Sub btangka_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btangka.Click
        Dim i As Integer
        i = 1
        Do
            ListBox1.Items.Add(i)
            i = i + 1
        Loop Until i > 10
    End Sub
    Private Sub btsatu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsatu.Click
        If ListBox1.SelectedItem = vbNullString Then
            MsgBox("Dipilih dulu lha....", vbCritical, "Pesan")
            ListBox1.Focus()
        Else
            ListBox2.Items.Add(ListBox1.SelectedItem)
            ListBox1.Items.Remove(ListBox1.SelectedItem)
        End If
    End Sub
    Private Sub btbeberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btbeberapa.Click
        Dim pilih As Integer
        Dim x As Integer
        Dim y As Integer
        x = ListBox1.Items.Count
        y = ListBox1.SelectedIndices.Count
        If ListBox1.SelectedItem = vbNullString Then
            MsgBox("di isi disit textbox'e ", vbCritical, "Pesan")
            ListBox1.Focus()
        Else
            For pilih = 0 To y - 1
                ListBox2.Items.Add(ListBox1.SelectedItem)
                ListBox1.Items.Remove(ListBox1.SelectedItem)
            Next
        End If
    End Sub
    Private Sub btsemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsemua.Click
        Dim x, y As Integer
        y = ListBox1.Items.Count
        For x = 0 To y - 1
            ListBox2.Items.Add(ListBox1.Items(x))
        Next
        ListBox1.Items.Clear()
    End Sub

    Private Sub bthpssatu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bthpssatu.Click
        If ListBox2.SelectedItem = vbNullString Then
            MsgBox("Dipilih dulu lha....", vbCritical, "Pesan")
            ListBox2.Focus()
        Else
            ListBox2.Items.Remove(ListBox2.SelectedItem)
        End If
    End Sub
    Private Sub bthpsbeberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bthpsbeberapa.Click
        Dim x, y As Integer

        y = ListBox2.SelectedIndices.Count

        If ListBox2.SelectedItem = vbNullString Then
            MsgBox("silahkan pilih beberapa yang akan di hapus ", vbCritical, "pesan")
            ListBox2.Focus()
        Else
            For x = 0 To y - 1

                ListBox2.Items.Remove(ListBox2.SelectedItem)
            Next
        End If
    End Sub
    Private Sub bthpssemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bthpssemua.Click
        ListBox2.Items.Clear()
    End Sub
    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
        Close()
    End Sub
End Class

Catatan : 
  • ListBox1.SelectionMode = SelectionMode.MultiExtended berfungsi atar item yang kita pilih bisa beberapa ataupun semua.
  • ListBox1.Items.Add(ListBox1.SelectedItem) berfungsi untuk menambahkan item atau pilihan sesuai pilihan yang telah kita select pada LisBox1.
  • ListBox1.Items.Remove(ListBox1.SelectedItem) berfungsi untuk menghapus pilihan sesuai pilihan yang telah kita select pada ListBox1
  • ListBox1.Items.Clear() berfungsi untuk menghapus semua pilihan pada ListBox1.
  • ListBox1.SelectedIndices.Count berfungsi untuk mengkoleksi pilihan yang sedang dipilih (Beberapa Pilihan).