Pilih di menu Windows Form Application Visual basic
Isi pada kolom Nama, Trus OK
Buat Form seperti tampilan berikut
Kodenya seperti ini
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add(”Pagi”)
ListBox1.Items.Add(”Siang”)
ListBox1.Items.Add(”Malam”)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
CheckedListBox1.Items.Add(”Tiwul”)
CheckedListBox1.Items.Add(”Nasi”)
CheckedListBox1.Items.Add(”Baso”)
Dim pilihan As String
pilihan = “Pilihanya….” + ListBox1.SelectedItem
TextBox1.Text = ListBox1.SelectedItem
MessageBox.Show(pilihan, “Menu saat ini adalah”, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
End
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
Dim jumlah As Integer
jumlah = CheckedListBox1.CheckedItems.Count
MessageBox.Show(CStr(jumlah), “Pilihan Berjumlah”,
MessageBoxButtons.OK, MessageBoxIcon.Information)
If jumlah = 2 Then
CheckedListBox1.Items.Add(”Cukup”)
End If
End Sub
End Class
Coba di Debug ( Run ), jika benar hasilnya seperti ini
Selamat mencoba
Atau download Program Disini.
Source : http://ekosuhartono.blogdetik.com/
No comments:
Post a Comment