The document contains code for a form that allows a user to select a food item category, specific food item, and quantity. It then calculates the total price and any discount to display the amount due. Dropdown menus are populated dynamically based on category selection. Price values are assigned to each food item and the total is calculated by multiplying price by quantity, applying a discount of 50,000 if total is over 500,000.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
47 views2 pages
Form 1
The document contains code for a form that allows a user to select a food item category, specific food item, and quantity. It then calculates the total price and any discount to display the amount due. Dropdown menus are populated dynamically based on category selection. Price values are assigned to each food item and the total is calculated by multiplying price by quantity, applying a discount of 50,000 if total is over 500,000.
cmbnama.Items.Clear() cmbnama.Text = "" cmbnama.Items.Add("Pizza Pasta") cmbnama.Items.Add("Pizza Sicilia") cmbnama.Items.Add("Cheesy Crust") End If End Sub
Private Sub cmbnama_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
cmbnama.SelectedIndexChanged If cmbnama.Text = "Kerang" Then txtharga.Text = 60000 ElseIf cmbnama.Text = "Kepiting" Then txtharga.Text = 80000 ElseIf cmbnama.Text = "Lobster" Then txtharga.Text = 100000 ElseIf cmbnama.Text = "Ayam Goreng" Then txtharga.Text = 50000 ElseIf cmbnama.Text = "Ayam Bakar" Then txtharga.Text = 90000 ElseIf cmbnama.Text = "Ayam Geprek" Then txtharga.Text = 100000 ElseIf cmbnama.Text = "Pizza Pasta" Then txtharga.Text = 120000 ElseIf cmbnama.Text = "Pizza Sicilia" Then txtharga.Text = 120000 ElseIf cmbnama.Text = "Pizza Cheesy Crust" Then txtharga.Text = 150000 End If End Sub
Private Sub btnhitung_Click(sender As Object, e As EventArgs) Handles btnhitung.Click
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text) If txttotal.Text > 500000 Then txtpotongan.Text = 50000 Else txtpotongan.Text = 0 End If txtbayar.Text = Val(txttotal.Text) - Val(txtpotongan.Text) End Sub
Private Sub btnbatal_Click(sender As Object, e As EventArgs) Handles btnbatal.Click