EnglishFrenchGermanSpainItalian DutchRussianPortugueseJapaneseKorean

Google Search

Custom Search

Saturday, May 16, 2009

Penggunaan CheckBox dan ListBox



kode programnya adalah:


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pil1 As String
Dim pil2 As String

pil1 = ""
pil2 = ""

If CheckBox1.Checked = True Then
pil1 = "Komputer"
End If

If CheckBox2.Checked = True Then
pil2 = "Printer"
End If

Label2.Text = "Anda sudah membeli : " + pil1 + "," + pil2
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dafPilihan.Items.Add("Matematika")
dafPilihan.Items.Add("Fisika")
dafPilihan.Items.Add("Kimia")
dafPilihan.Items.Add("Biologi")
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label4.Text = "Anda memilih : " + dafPilihan.SelectedItem
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Label2.Text = ""
Label4.Text = ""
End Sub

End Class

Komponen yang digunakan adalah:
1. Label
Label1(Name)-> Pilih yang akan dibeli: (Caption)
Label2(Name)-> (Caption)
Label3(Name)-> Pelajaran yang anda sukai: (Caption)
Label4(Name)-> (Caption)
2. CheckBox
pil1(Name)->Komputer(Caption)
pil2(Name)->Printer(Caption)
3. ListBox
dafPilihan(Name)
4. Button
Button1(Name)->OK(Caption)
Button2(Name)->OK(Caption)
Button3(Name)->Clear(Caption)

Selamat Mencoba,

Ridon-Na70

Masukkan Code ini K1-EY8895-E
untuk berbelanja di KutuKutuBuku.com