Penjelasan :
1 . Paling awal pada kotak sebelah kiri kita mengisi dan masuk ke kotak list yang pertama
2. Klik angka 1 - 10 untuk menambahkan list yang pertama
3. Lalu klik salah satu diantara dari semua angka tersebut untuk pindah ke kotak list kedua .
4. Tetapi jika mendapat pesan semua angka pindah ke kotak list kedua maka semuanya akan pindah termasuk yang sebelumnya sudah diklik untuk pindah .Angka yang pindah ke kotak list kedua sesuai urutan pemindahan .
Script Program :
‘Button Isi Data
Private Sub Btisi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btisi.Click
ListBox1.Items.Add(TextBox1.Text)
End Sub
‘Button 1-10
Private Sub Bt1-10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt1-10Click
Dim A As Integer
A = 0
Do
A = A + 1
ListBox1.Items.Add(A)
Loop Until A = 10
End Sub
‘Button Satu
Private Sub Btsatu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btsatu.Click
ListBox2.Items.Add(ListBox1.SelectedItem)
End Sub
‘Button Beberapa
Private Sub Btbeberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btbeberapa.Click
Dim obj As Object
For Each obj In ListBox1.SelectedItems
ListBox2.Items.Add(obj)
Next
End Sub
‘Button Semua
Private Sub Btsemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btsemua.Click
ListBox2.Items.AddRange(ListBox1.Items)
End Sub
‘Button Hapus Satu
Private Sub Bthpssatu.Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bthpssatu.Click
Dim obj As Object
obj = ListBox2.SelectedItem
ListBox2.Items.Remove(obj)
End Sub
‘Button Hapus Beberapa
Private Sub Bthpsbeberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bthpsbeberapa.Click
For i As Integer = 0 To ListBox2.SelectedIndices.Count - 1
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Next
End Sub
‘Button Hapus Semua
Private Sub Bthpssemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bthpssemua.Click
ListBox2.Items.Clear()
End Sub
‘Button Tutup
Private Sub Bttutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bttutup.Click
Me.Close()
End Sub
0 komentar:
Posting Komentar