0% found this document useful (0 votes)
27 views3 pages

Form1 Object Eventargs: "Coffee" "Tea"

This document contains the code for a Visual Basic .NET Windows Forms application that allows a user to select a drink, flavor, size and quantity and calculates the total cost. It includes code to: 1) Populate two combo boxes with drink and flavor options when the form loads. 2) Clear and populate the flavor combo box differently depending on the selected drink. 3) Calculate the price for each size/drink/flavor combination and display the selected options and total cost on a second form when the user clicks the order button.

Uploaded by

kishi8mempin
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
27 views3 pages

Form1 Object Eventargs: "Coffee" "Tea"

This document contains the code for a Visual Basic .NET Windows Forms application that allows a user to select a drink, flavor, size and quantity and calculates the total cost. It includes code to: 1) Populate two combo boxes with drink and flavor options when the form loads. 2) Clear and populate the flavor combo box differently depending on the selected drink. 3) Calculate the price for each size/drink/flavor combination and display the selected options and total cost on a second form when the user clicks the order button.

Uploaded by

kishi8mempin
Copyright
© © All Rights Reserved
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
You are on page 1/ 3

Public Class Form1

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Label3.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
With cbodrinks.Items
.Add("Coffee")
.Add("Tea")
End With
End Sub
Private Sub cbodrinks_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cbodrinks.SelectedIndexChanged
If cbodrinks.SelectedIndex = 0 Then
With cboflavor.Items
.Add("Brewed")
.Add("Iced Coffee")
.Add("Americano")
.Add("Cafe Latte")
.Add("Caramel Macchiato")
End With
End If
If cbodrinks.SelectedIndex = 1 Then
With cboflavor.Items
.Clear()
.Add("Classic Chai Tea")
.Add("Peach Green Tea")
.Add("Berry Berry Hibiscus")
End With
End If
End Sub
Private Sub cmdorder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles cmdorder.Click
Dim Drink, Flavor, Qty, Amount, Total As String
Qty = txtqty.Text
Me.Hide()
With Form2
.Show()
If rdotall.Checked = True Then
Form2.lblsize.Text = "Tall"
If cbodrinks.SelectedIndex = 0 Then
If cboflavor.SelectedIndex = 0 Then
Amount = 115
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 145
ElseIf cboflavor.SelectedIndex = 2 Then
Amount = 120
ElseIf cboflavor.SelectedIndex = 3 Then
Amount = 140
Else
Amount = 175
End If
ElseIf cbodrinks.SelectedIndex = 1 Then

If cboflavor.SelectedIndex = 0 Then
Amount = 110
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 140
Else
Amount = 195
End If
End If
ElseIf rdogrande.Checked = True Then
Form2.lblsize.Text = "Grande"
If cbodrinks.SelectedIndex = 0 Then
If cboflavor.SelectedIndex = 0 Then
Amount = 130
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 170
ElseIf cboflavor.SelectedIndex = 2 Then
Amount = 195
ElseIf cboflavor.SelectedIndex = 3 Then
Amount = 165
ElseIf cboflavor.SelectedIndex = 4 Then
Amount = 200
End If
ElseIf cbodrinks.SelectedIndex = 1 Then
If cboflavor.SelectedIndex = 0 Then
Amount = 120
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 160
Else
Amount = 220
End If
End If
ElseIf rdoventi.Checked = True Then
Form2.lblsize.Text = "Venti"
If cbodrinks.SelectedIndex = 0 Then
If cboflavor.SelectedIndex = 0 Then
Amount = 145
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 195
ElseIf cboflavor.SelectedIndex = 2 Then
Amount = 170
ElseIf cboflavor.SelectedIndex = 3 Then
Amount = 190
Else
Amount = 225
End If
ElseIf cbodrinks.SelectedIndex = 1 Then
If cboflavor.SelectedIndex = 0 Then
Amount = 135
ElseIf cboflavor.SelectedIndex = 1 Then
Amount = 180
Else
Amount = 225
End If
End If
End If
Drink = cbodrinks.Text
Flavor = cboflavor.Text
Total = Qty * Amount

.lbldrink.Text = Drink
.lblflavor.Text = Flavor
.lblqty.Text = Qty
.lbltotal.Text = Total
End With
End Sub
End Class

You might also like