CARA MEMBUAT DAFTAR MENU PADA PROGRAM VISUAL BASIC 2010
ASS. Wr. Wb. Dalam kesempatan Kali ini saya ingin berbagi
sedikit tentang membuat daftar menu makanan pada program visual basic 2010, walaupun
ndak terlalu bagus tapi lumayanlah buat belajar.
Okee… tanpa basa basi lagi kita lansung ke
langkah-langkahnya,
Terlebih dahulu buka start menu,
Kemudian pilih program visual basic 2010.
Lalu, new project
Kemudian pilih mindows form Application,
disini juga terdapat location yaitu untuk mengatur dimana tempat anda menyimpan
file, kemudian OK.
Setelah di OK akan muncul tampilan seperti di
bawah ini (form 1).
Lalu buat tampilan seperti di bawah ini,
menggunakan Radiobutton, Label, Groupbox, dan Button.
Untuk merubah nama sesuai daftar menu yang ingin kita buat maka double klik di dalam form 1,Terus buat kodingan seperti dibawahi ini,
Setelah itu double klik di Radiobutton untuk memberikan perintah (koding) agar bias di jalankan, begitu juga berikkutnya, disini kita bermain sedikit logika.
Double klik di button1 untuk membuat koding supaya total penbelian bisa muncul, dan double klik di button2 untuk membuat perintah (koding) hapus,
Nie.. koding lengkapnya,,
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Menu Makanan"
RadioButton1.Text = "Mie Ayam"
RadioButton2.Text = "Nasi Goreng"
RadioButton3.Text = "Lalapan"
RadioButton4.Text = "Soto Ayam"
Label1.Text = "Menu"
Label2.Text = "Harga"
GroupBox1.Text = "Menu Makanan"
GroupBox2.Text = "Menu Miniman"
RadioButton5.Text = "Teh Manis"
RadioButton6.Text = "Jus"
RadioButton7.Text = "Air Putih"
Label3.Text = "Menu"
Label4.Text = "Harga"
GroupBox3.Text = "Total"
Label5.Text = "Total yang harus di bayar"
Label6.Text = "Rp. ..."
Button1.Text = "Show"
Button2.Text = "Clear"
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked Then
Label1.Text = RadioButton1.Text
Label2.Text = "Rp. 8,000"
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked Then
Label1.Text = RadioButton2.Text
Label2.Text = "Rp. 12,000"
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked Then
Label1.Text = RadioButton3.Text
Label2.Text = "Rp. 10,000"
End If
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked Then
Label1.Text = RadioButton4.Text
Label2.Text = "Rp. 11,000"
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
If RadioButton5.Checked Then
Label3.Text = RadioButton5.Text
Label4.Text = "Rp. 2,000"
End If
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
If RadioButton6.Checked Then
Label3.Text = RadioButton6.Text
Label4.Text = "Rp. 3,000"
End If
End Sub
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
If RadioButton7.Checked Then
Label3.Text = RadioButton7.Text
Label4.Text = "Rp. 1,000"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label6.Text = "Rp. ..."
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 10,000"
End If
If RadioButton2.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 14,000"
End If
If RadioButton3.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 12,000"
End If
If RadioButton4.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton1.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 11,000"
End If
If RadioButton2.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 15,000"
End If
If RadioButton3.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton4.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 14,000"
End If
If RadioButton1.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 9,000"
End If
If RadioButton2.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton3.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 11,000"
End If
If RadioButton4.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 12,000"
End If
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Menu Makanan"
RadioButton1.Text = "Mie Ayam"
RadioButton2.Text = "Nasi Goreng"
RadioButton3.Text = "Lalapan"
RadioButton4.Text = "Soto Ayam"
Label1.Text = "Menu"
Label2.Text = "Harga"
GroupBox1.Text = "Menu Makanan"
GroupBox2.Text = "Menu Miniman"
RadioButton5.Text = "Teh Manis"
RadioButton6.Text = "Jus"
RadioButton7.Text = "Air Putih"
Label3.Text = "Menu"
Label4.Text = "Harga"
GroupBox3.Text = "Total"
Label5.Text = "Total yang harus di bayar"
Label6.Text = "Rp. ..."
Button1.Text = "Show"
Button2.Text = "Clear"
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked Then
Label1.Text = RadioButton1.Text
Label2.Text = "Rp. 8,000"
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked Then
Label1.Text = RadioButton2.Text
Label2.Text = "Rp. 12,000"
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked Then
Label1.Text = RadioButton3.Text
Label2.Text = "Rp. 10,000"
End If
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked Then
Label1.Text = RadioButton4.Text
Label2.Text = "Rp. 11,000"
End If
End Sub
Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged
If RadioButton5.Checked Then
Label3.Text = RadioButton5.Text
Label4.Text = "Rp. 2,000"
End If
End Sub
Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged
If RadioButton6.Checked Then
Label3.Text = RadioButton6.Text
Label4.Text = "Rp. 3,000"
End If
End Sub
Private Sub RadioButton7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton7.CheckedChanged
If RadioButton7.Checked Then
Label3.Text = RadioButton7.Text
Label4.Text = "Rp. 1,000"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label6.Text = "Rp. ..."
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 10,000"
End If
If RadioButton2.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 14,000"
End If
If RadioButton3.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 12,000"
End If
If RadioButton4.Checked And RadioButton5.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton1.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 11,000"
End If
If RadioButton2.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 15,000"
End If
If RadioButton3.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton4.Checked And RadioButton6.Checked Then
Label6.Text = "Rp. 14,000"
End If
If RadioButton1.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 9,000"
End If
If RadioButton2.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 13,000"
End If
If RadioButton3.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 11,000"
End If
If RadioButton4.Checked And RadioButton7.Checked Then
Label6.Text = "Rp. 12,000"
End If
End Sub
End Class
Jika semua sudah , coba di run (jalankan). Jika
berhasil akan muncul tampilan seperti ini,,
Selamat deh klo berhasil,, bagi yang belum coba
lagi yaa,,, jangan menyerah OK….
Sekian dari saya, tanks,,
Tidak ada komentar:
Posting Komentar