Inilah listing program berdasarkan komponen yang digunakan:
- Combobox1:
Select Case ComboBox1.Text
Case “Nasi Uduk”
Label2.Text = “Rp. 3500”
hrgmakanan = 3500
Case “Bakso”
Label2.Text = “Rp. 6000”
hrgmakanan = 6000
Case “Mie Ayam”
Label2.Text = “Rp. 7000”
hrgmakanan = 7000
End Select
End Sub
- variabel di Form1:
Public hrgmakanan, hrgminuman As Integer
- Combobox2:
Select Case ComboBox2.Text
Case “Es Jeruk”
Label4.Text = “Rp. 3000”
hrgminuman = 3000
Case “Jus Alpukat”
Label4.Text = “Rp. 7000”
hrgminuman = 7000
Case “Teh Manis”
Label4.Text = “Rp. 4000”
hrgminuman = 4000
End Select
End Sub
- Sub-routine Public:
‘ This call is required by the designer. InitializeComponent()
ComboBox2.Visible = False
Label3.Visible = False
‘ Add any initialization after the InitializeComponent() call.
End Sub
- Checkbox1:
If CheckBox1.Enabled = False Then
ComboBox2.Visible = False
End If
If CheckBox1.Enabled = True Then
ComboBox2.Visible = True
Label3.Visible = True
End If
End Sub
- Button1:
Dim porsimkn, porsimnm, jumlah As Integer
porsimkn = TextBox1.Text
porsimnm = TextBox2.Text
jumlah = (hrgmakanan * porsimkn) + (hrgminuman * porsimnm)
Label7.Text = “Rp. ” & jumlah.ToString
End Sub
Tidak ada komentar:
Posting Komentar