Friday, November 9, 2012

Tugas 4 CheckBox, RadioButton dan ListBox


 PROGRAM "CHECKBOX"
---------------------------------------------------------------------------------
1. Desain form'nya seperti dibawah ini;  

      Adapun tool yang dipake sebagai berikut;

  • Tool CheckBox untuk mengisi Bahasa-bahasa yang dipilih
  • GroupBox untuk menggabungkan seluruh bahasa dan saya beri nama "Kemampuan   Berbahasa".
  • TextBox untuk menampilkan
  • Dan yang terakhir tool Button untuk proses












2.  Lalu isi Listing Programnya sebagai berikut;

    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


3. Lalu Run/Play
    Setelah muncul lalu pilih bahasa.











Setelah dipilih lalu clik tombol "Proses" dan akan tampil seperti gambar dibawah ini;











Terima Kasih..


PROGRAM  "RADIOBUTTON"
-----------------------------------------------------------------------------

1. Desain form'nya seperti dibawah ini;  

      Adapun tool yang dipake sebagai berikut;

  • Tool RadioButton untuk mengisi Pria, wanita, kawin, dan tidak kawin 
  • Panel Sebagai pemisah antara jenis kelamin dan status
  • TextBox untuk menampilkan hasilnya
  • Dan yang terakhir tool Button untuk tutup













2. Isi listing Programnya sebagai berikut;

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
        If RbWanita.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
        If RbWanita.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


3. Run/Play Program tadi,



* Jika kita klik jenis kelamin pria dan status kawin maka secara otomatis akan muncul "Istri" Pada pasangan hidup
 


* Dan sebaliknya Jika kita klik jenis kelamin Wanita dan status kawin maka secara otomatis akan muncul "Suami" Pada pasangan hidup








* Jika kita klik jenis kelamin pria/wanita dan status tidak kawin maka secara otomatis akan muncul "(kosong)" Pada pasangan hidup










PROGRAM  "LISTBOX"
-----------------------------------------------------------------------------
1. Desain form'nya seperti dibawah ini;  

      Adapun tool yang dipake sebagai berikut;

  • Tool ListBox 
  • TextBox untuk menampilkan mengisi yang akan dimasukan ke dalam listbox1
  • Dan yang terakhir tool Button untuk tutup










2. Isi Listing Programnya sebagai berikut;

 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
        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 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


3. Lalu di Run/Play

* Setelah di ketik pada textbox lalu klik isi, lalu akan pindah ke listbox 1.









* Jika di click tombol 1-10 ; maka akan terisi angka 1 sampai 10









 * Apabila memilih angka 1 dan click tombol 1 maka angka 1 masuk ke listbox2








* click Tombol beberapa akan mengisi beberapa data yang dipilih








*jika clik tombol semua maka data yang ada di listbox 1 akan masuk semua ke listbox2








*Dan jika di clik hapus satu maka akan hilang satu seperti yang saya klik pada listbox2 yaitu angka 1 paling atas, dan akan terhapus.






*Ketika saya pilih angka 5-10 dan clik hapus beberapa maka akan terhapus.









* dan yang terakhir ketika di clik tombol hapus semua maka listbox2 semua akan terhapus



Terima Kasih.... 
Mohon Maaf apabila masih banyak kekurangan...

Mohon Koment'nya untuk perbaikan, agar program ini lebih baik..   :)

@Khatirudinm




Unknown

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment

 

Copyright @ 2010 FULL INFO.