Nama : Dwi Susanti
Kelas : TI 11 C
NIM : 11.11.2495
LISTBOX
Gambar
terdiri dari :
Jenis
Objek
|
Text
|
Nama
|
Backcolor
|
Fontcolor
|
Font
|
Form1
|
Form1
|
Form1
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
TextBox1
|
TextBox1
|
-
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button1
|
Button1
|
Isi
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button2
|
Button2
|
1 – 10
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button3
|
Button3
|
Satu >>
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button4
|
Button4
|
Beberapa >>
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button5
|
Button5
|
Semua >>
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button6
|
Button6
|
Hapus Satu
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button7
|
Button7
|
Hapus Beberapa
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Button8
|
Button8
|
Hapus Semua
|
-
|
Black
|
Microsoft Sans
Serif; -8,25pt
|
Button9
|
Button9
|
Tutup
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
ListBox1
|
ListBox1
|
-
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
ListBox2
|
ListBox2
|
-
|
-
|
Black
|
Microsoft Sans
Serif; 8,25pt
|
Saat mengisi TextBox seperti
gambar di bawah ini, dan klik tombol isi maka isian di textbox akan berpindah
kelistbox. Contohnya pad gambar di bawah di textbox berisi “Susan” ketika
tombol isi diklik maka nama “Susan” pindah kelistbox, amati gambar di bawah :
Berikut
ini listing programnya :
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button1.Click
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Saat Tombol 1 – 10 diklik maka di listbox akan muncul
angka 1 – 10.
Listing program untuk tombol “1 – 10” :
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button2.Click
Dim x As Integer
For x = 1 To 10
ListBox1.Items.Add(x)
Next
End Sub
Saat
klik tombol satu >> maka isian pada listbox1 yang diblog akan berpindah
ke listbox2, begitu juga bila tombol Beberapa >> diklik.
Listing
program untuk tombol “Satu” :
Private Sub Button3_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button3.Click
ListBox2.Items.Add(ListBox1.SelectedItem)
End Sub
Listing
program untuk tombol “Beberapa” :
Private Sub Button4_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button4.Click
Dim beberapa = (From
i In ListBox1.SelectedItems).ToArray()
For Each SelectedItems
In beberapa
ListBox2.Items.Add(SelectedItems)
Next
End Sub
Bila
klik tombol semua maka akan berpindah semua data/isian yang ada pada listbox1
ke listbox2.
Listing
program untuk tombol “Semua” :
Private Sub Button5_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button5.Click
Dim semua = (From i In ListBox1.Items).ToArray()
For Each Items In semua
ListBox2.Items.Add(Items)
Next
End Sub
Untuk
tombol “Hapus Satu” data yang ada pada listbox yang diblog akan terhapus,
begitu juga dengan tombol “Hapus Beberapa”.
Listing
program untuk tombol “Hapus Satu” :
Private Sub Button6_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button6.Click
ListBox2.Items.Remove(ListBox2.SelectedItem)
End
Sub
Listing
Program untuk tombol “Hapus Beberapa” :
Private Sub Button7_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button7.Click
Dim beberapa = (From
i In ListBox2.SelectedItems).ToArray()
For Each
SelectedItems In beberapa
ListBox2.Items.Remove(SelectedItems)
Next
End Sub
Saat
tombol “Hapus Semua” diklik maka data/isian pada listbox2 akan terhapus
semua/kosong.
Listing program untuk tombol “Hapus Semua” :
Private Sub Button8_Click(ByVal sender As
System.Object, ByVal
e As System.EventArgs)
Handles Button8.Click
ListBox2.Items.Clear()
End Sub
Berikut
ini keseluruhan listing program yang ada pada program Listbox di atas :
Public Class Form1
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim x As Integer
For x = 1 To 10
ListBox1.Items.Add(x)
Next
End Sub
Private Sub
Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
ListBox2.Items.Add(ListBox1.SelectedItem)
End Sub
Private Sub
Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button4.Click
Dim beberapa = (From
i In ListBox1.SelectedItems).ToArray()
For Each
SelectedItems In beberapa
ListBox2.Items.Add(SelectedItems)
Next
End Sub
Private Sub
Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
Dim semua = (From i In ListBox1.Items).ToArray()
For Each Items In semua
ListBox2.Items.Add(Items)
Next
End Sub
Private Sub
Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button6.Click
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub
Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button7.Click
Dim beberapa = (From
i In ListBox2.SelectedItems).ToArray()
For Each
SelectedItems In beberapa
ListBox2.Items.Remove(SelectedItems)
Next
End Sub
Private Sub
Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button8.Click
ListBox2.Items.Clear()
End Sub
Private Sub
Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button9.Click
Me.Close()
End Sub
End Class
KEMAMPUAN BERBAHASA
Tampilan di atas terdiri dari :
Jenis
Objek
|
Text
|
Nama
|
Backcolor
|
Fontcolor
|
Font
|
Form1
|
Form1
|
Form1
|
gray
|
-
|
-
|
GroupBox1
|
Kemampuan Berbahasa
|
GroupBox1
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
CheckBox1
|
Indonesia
|
CheckBox1
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
CheckBox2
|
Inggris
|
CheckBox2
|
gray
|
red
|
Ravie; 9,75pt; style=Bol
|
CheckBox3
|
Arab
|
CheckBox3
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
CheckBox4
|
Sunda
|
CheckBox4
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
CheckBox5
|
Jawa
|
CheckBox5
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
CheckBox6
|
Lain - lain
|
CheckBox6
|
gray
|
red
|
Ravie; 9,75pt; style=Bold
|
TextBox1
|
-
|
TextBox1
|
-
|
red
|
Ravie; 9,75pt; style=Bold
|
Button1
|
Tampilkan
|
Button1
|
-
|
red
|
Ravie; 9,75pt; style=Bold
|
Setelah
pilih bahasa yang dikuasai lalu klik tombol tampil maka akan muncul seperti di
bawah ini.
Mungkin
pertama kita klik akan terbaca dari belakang maka harus diatur, berikut ini
cara mengaturnya :
- Pilih show All Files pada solution explorer
- Lalu double klik pada form1.designer.vb
- Lalu urutkan nomor pada checkbox seperti di bawah ini
:
Berikut ini listing program untuk Button1 :
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
For Each control In Me.GroupBox1.Controls
If
control.Checked = True Then
TextBox1.Text &=
control.Text & ", "
End
If
Next
TextBox1.Text =
Microsoft.VisualBasic.Left(TextBox1.Text, Len(TextBox1.Text) - 2)
End Sub
End Class
PASANGAN HIDUP
Berikut ini Listing program :
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
If
RadioButton1.Checked = True And
RadioButton3.Checked = True Then
TextBox1.Text = "Istri"
End If
If
RadioButton2.Checked = True And
RadioButton3.Checked = True Then
TextBox1.Text = "Suami"
End If
If
RadioButton1.Checked = True And
RadioButton4.Checked = True Then
TextBox1.Text = ""
End If
If
RadioButton2.Checked = True And
RadioButton4.Checked = True Then
TextBox1.Text = ""
End If
End Sub
End Class