"CHECKBOX"
Ketentuan
:
Semua bahasa
yang dipilih user ditampilkan pada textbox
DesainForm
:
·
1GroupBox , text di propertis tulis
“Kemampuan Berbahasa”
·
6 Checklist , masing-masing checklist tuliskan
“Indonesia, Inggris, Sunda, Jawa, Arab, dan Lain-lain”
·
1 TextBox
·
1 Button, untuk proses
Listing Program :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim control As Windows.Forms.CheckBox
TextBox1.Text = ""
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) - 1)
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
Dim control As Windows.Forms.CheckBox
TextBox1.Text = ""
End Sub
End Class
Dim control As Windows.Forms.CheckBox
TextBox1.Text = ""
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) - 1)
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
Dim control As Windows.Forms.CheckBox
TextBox1.Text = ""
End Sub
End Class
Hasil:
1. Klik F5 / Debugging, dan klik bahasa yang anda suka ,misalkan seperti gambar berikut:
1. Klik F5 / Debugging, dan klik bahasa yang anda suka ,misalkan seperti gambar berikut:
2. Setelah dipilih klik Proses maka akan muncul pada textboox seperti gambar di
bawah ini:
"RADIOBUTTON”
Ketentuan:
Isi
pasangan hidup dengan suami jika jenis kelamin wanita dan status kawin,
dan isi dengan istri jika jenis kelamin pria dan status kawin.
DesainForm
:
· 2 Panel, utuk pemisah bagian radiobutton jenis kelamin dan status
· 4 RadioButton ,Panel 1”Pria danWanita ” ,Panel 2 “Kawin,
dan Belum Kawin”
·
3 Label , text di properties
tuliskan“Jenis Kelamin , Status, danPasangan ”
·
1 Button, untuk menutup program
Listing Program :
Public Class Form1
Private Sub RbKawin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbKawin.CheckedChanged
TextBox1.Text = ""
If RbPria.Checked = True Then
Else
TextBox1.Text &= "Suami"
End If
IfRbWanita.Checked = True Then
Else
TextBox1.Text &= "Istri"
End If
End Sub
Private Sub RbTdkwin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbTdkwin.CheckedChanged
TextBox1.Text = ""
If RbPria.Checked = True Then
Else
TextBox1.Text &= ""
End If
IfRbWanita.Checked = True Then
Else
TextBox1.Text &= ""
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
Hasil :
1.
Klik F5/ Debugging
·
Ketika kita klik jenis kelamin pria dan status
kawin maka akan muncul "Istri" padap asangan hidup
·
SebaliknyaketikakitaklikjeniskelaminWanitadan
status kawinmakaakanmuncul "Suami" padapasanganhidup
·
Dan ketika kita klik jenis kelamin pria/wanita dan
status tidak kawin maka akan muncul "(kosong)" padapasanganhidup
"LISTBOX"
Ketentuan :
·
Isi, mingisi ListBox1
dengan isian yang ada di Textbox1
·
1-10,mengisi ListBox1
dengan angka dari 1-10
·
Satu, memasukkan satu pilihan
yang dipilih dari ListBox1 ke ListBox2
·
Beberapa,
memasukkan beberapa pilihan yang dipilih dari ListBox1 ke ListBox2
·
Semua, memasuk kansemua pilihan
yang dipilih dari ListBox1 ke ListBox2
·
Hapus satu,
menghapus satu pilihan dari ListBox2 yang sedang dipilih
·
Hapus beberapa, menghapus beberapa pilihan dari
ListBox2 yang sedang dipilih
·
Hapus semua,
menghapus semua pilihan dari ListBox2 yang sedang dipilih
DesainForm
:
·
1 TextBox
·
9 Button
·
2 ListBox
Listing Program :
Public
Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim control As Windows.Forms.ListBox
TextBox1.Text = TextBox1.Text
TextBox1.Text = ListBox1.Items.Add(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For bil = 1 To 10
ListBox1.Items.Add(bil)
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Satu.Click
ListBox1.Text = ListBox2.Items.Add(ListBox1.Text)
End Sub
Private Sub Bt_Beberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Beberapa.Click
ListBox1.SelectionMode = SelectionMode.MultiExtended
Dim i, j As Integer
j = ListBox1.Items.Count
For i = 0 To j - 1
Try
ListBox2.Items.Add(ListBox1.Items(ListBox1.SelectedIndices(i)))
Catch ex As Exception
j -= 1
End Try
Next
End Sub
Private Sub Bt_Semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Semua.Click
ListBox1.SelectionMode = SelectionMode.MultiExtended
Dim Jumlah As Integer = ListBox1.Items.Count
For i = 0 To Jumlah - 1
ListBox2.Items.Add(ListBox1.Items(i))
Next
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Satu.Click
ListBox2.SelectionMode = SelectionMode.One
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub Bt_Hapus_Beberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Beberapa.Click
ListBox2.SelectionMode = SelectionMode.MultiExtended
Dim i, j As Integer
j = ListBox2.Items.Count
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Catch ex As Exception
j -= 1
End Try
For i = 0 To j - 1
Try
Next
End Sub
Private Sub Bt_Hapus_Semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Semua.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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim control As Windows.Forms.ListBox
TextBox1.Text = TextBox1.Text
TextBox1.Text = ListBox1.Items.Add(TextBox1.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For bil = 1 To 10
ListBox1.Items.Add(bil)
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Satu.Click
ListBox1.Text = ListBox2.Items.Add(ListBox1.Text)
End Sub
Private Sub Bt_Beberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Beberapa.Click
ListBox1.SelectionMode = SelectionMode.MultiExtended
Dim i, j As Integer
j = ListBox1.Items.Count
For i = 0 To j - 1
Try
ListBox2.Items.Add(ListBox1.Items(ListBox1.SelectedIndices(i)))
Catch ex As Exception
j -= 1
End Try
Next
End Sub
Private Sub Bt_Semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Semua.Click
ListBox1.SelectionMode = SelectionMode.MultiExtended
Dim Jumlah As Integer = ListBox1.Items.Count
For i = 0 To Jumlah - 1
ListBox2.Items.Add(ListBox1.Items(i))
Next
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Satu.Click
ListBox2.SelectionMode = SelectionMode.One
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub Bt_Hapus_Beberapa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Beberapa.Click
ListBox2.SelectionMode = SelectionMode.MultiExtended
Dim i, j As Integer
j = ListBox2.Items.Count
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Catch ex As Exception
j -= 1
End Try
For i = 0 To j - 1
Try
Next
End Sub
Private Sub Bt_Hapus_Semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_Hapus_Semua.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
No comments:
Post a Comment