Membuat RadioButton dengan isi pasangan hidup dengan Suami jika jenis kelamin Wanita dan status kawin, isi dengan Istri jika jenis kelamin pria dan status kawin.
Berikut hasilnya :
dan listingya :
Public Class Form1
Private Sub Rdbkawin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rdbkawin.CheckedChanged
TextBox1.Text = ""
If Rdbpria.Checked = True Then
Else
TextBox1.Text &= "Suami"
End If
If Rdbwanita.Checked = True Then
Else
TextBox1.Text &= "Istri"
End If
End Sub
Private Sub Rdbblmkawin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rdbblmkawin.CheckedChanged
TextBox1.Text = ""
If Rdbpria.Checked = True Then
Else
TextBox1.Text &= ""
End If
If Rdbwanita.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
Untuk Mendownload Program RadioButton : http://www.ziddu.com/download/20856200/programradiobuton.zip.html
2. Program ListBox
Membuat ListBox dengan ketentuan sbb :
Isi → Mengisi list1 dengan isian yang ada pada text1
1-10 → Mengisi list1 dengan angka dari 1 - 10
Satu > → Memasukan satu pilihan yang dipilih dari list1 ke list2
Beberapa > → Memasukan beberapa pilihan yang sedang dipilih dari list1 ke list2
Semua > → Memasukan semua pilihan yang ada di list1 ke lis2
Hapus Satu → menghapus satu pilihan dari list2 yang sedang dipilih
Hapus Beberapa → Menghapus beberapa pilihan dari list2 yang sedang dipilih
Hapus Semua → Menghapus semua pilihan yang ada di list2
Berikut Hasilnya :
dan Listingnya:
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 Button3.Click
ListBox1.Text = ListBox2.Items.Add(ListBox1.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.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 Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.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 Button6.Click
ListBox2.SelectionMode = SelectionMode.One
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox2.SelectionMode = SelectionMode.MultiExtended
Dim i, j As Integer
j = ListBox2.Items.Count
For i = 0 To j - 1
Try
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
Catch ex As Exception
j -= 1
End Try
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
untuk mendowload list box :
http://www.ziddu.com/download/20856207/programlistbox.zip.html
Comments
Post a Comment