My code so far
You could use two parallel arrays, one for the name of the pizza, and one for the cost. Otherwise, use an If block to assign the cost of the pizza according to its name. Accumulate the total inside the block, for each selected item. However, it doesn't make any sense to assign the value of $5 to the first 5 and $10 to the rest. You will have to post your code.
Public Class Pick_Up_Pizza_Options
Public Pizza() As String = {"BBQ Meatlovers", "Supreme", "Double Bacon Cheeseburger", "Godfather", "Firebreather", "Blue Cheese & Bacon", "Vegorama", "Bangers & Beef", "Champagne Ham & Cheese", "Hawaiian", "Pepperoni", "Simply Cheese", "Beef & Onion", "Veg Trio"}
Private Sub Pick_Up_Pizza_Options_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListOfPizza1.Items.AddRange(Pizza)
End Sub
This is a Add button to add pizza from listbox1 to listbox 2
Private Sub Add1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Add1.Click
CustomerSelectedPizza.Items.Add(ListOfPizza1.Text)
CustomerSelectedPizza.SelectedIndex = CustomerSelectedPizza.SelectedIndex + 1
If CustomerSelectedPizza.SelectedIndex > 5 Then
CustomerSelectedPizza.Items.Remove(CustomerSelectedPizza.Text)
End If
'Declare the variables that are constant'
Const fee_1 As Double = 8.5
Const fee_2 As Double = 13.5
'Declaring a variable to use for calculation, this has a starting value of 3'
Dim sum As Double = 3
If CustomerSelectedPizza.SelectedIndex = 0 Then
sum += fee_1
End If
If CustomerSelectedPizza.SelectedIndex = 1 Then
sum += fee_1
End If
If CustomerSelectedPizza.SelectedIndex = 2 Then
sum += fee_1
End If
If CustomerSelectedPizza.SelectedIndex = 3 Then
sum += fee_1
End If
If CustomerSelectedPizza.SelectedIndex = 4 Then
sum += fee_1
End If
If CustomerSelectedPizza.SelectedIndex = 5 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 6 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 7 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 8 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 9 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 10 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 11 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 12 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 13 Then
sum += fee_2
End If
If CustomerSelectedPizza.SelectedIndex = 14 Then
sum += fee_2
End If
'This code puts a $ infront of the total cost of pizzas.'
TotalCost.Text = sum.ToString("C")
End Sub
'This remove button will remove one pizza at a time from listbox2 if not needed.'
Private Sub Remove1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Remove1.Click
CustomerSelectedPizza.Items.Remove(CustomerSelectedPizza.Text)
End Sub
'This will clear the whole of listbox2'
Private Sub Clear1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear1.Click
CustomerSelectedPizza.Items.Clear()
TotalCost.Text = 3
End Sub
'This is submit button to move onto next form after completing selection'
Private Sub Submit1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.Click
End Sub
Private Sub CustomerSelectedPizza_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerSelectedPizza.SelectedIndexChanged
End Sub
End Class