Yuengling
New member
- Joined
- Apr 28, 2010
- Messages
- 1
- Programming Experience
- Beginner
To the code to stop the overwriting issue I'm having:
When I add single dvd's to the order it adds them fine and the total cost is correct but when i put the quantity of the dvd's to more than 1 its messes up the total cost.
E.G:
VB.NET:
Private Sub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
If ComboBox1.Text = "" Then
Return
Else
Quantity = Quantity + 1
txtQuantity.Text = Quantity
End If
End Sub
________________________________________________________________
Private Sub btnMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMinus.Click
If ComboBox1.Text = "" Then
Return
Else
Quantity = Quantity - 1
txtQuantity.Text = Quantity
End If
End Sub
____________________________________________________________
If ComboBox1.SelectedIndex = 0 Then
ListBox1.Items.Add(ComboBox1.SelectedItem & vbTab & " " & Quantity & " " & "@ €25.00" & vbTab & "Ready To Ship")
DVDCost = DVDCost + FullMetalJacket
Call CalculateTotalCost()
TextBox2.Text = "Total Cost inc. VAT & Delivery" & vbTab & "€" & TotalCostIncDel
End If
If ComboBox1.SelectedIndex = 1 Then
ListBox1.Items.Add(ComboBox1.SelectedItem & vbTab & " " & Quantity & " " & "@ €20.00" & vbTab & "Ready To Ship")
DVDCost = DVDCost + AmericanHistoryX
Call CalculateTotalCost()
TextBox2.Text = "Total Cost inc. VAT & Delivery" & vbTab & "€" & TotalCostIncDel
End If
If ComboBox1.SelectedIndex = 2 Then
ListBox1.Items.Add(ComboBox1.SelectedItem & vbTab & " " & Quantity & " " & "@ €9.99" & vbTab & "Ready To Ship")
DVDCost = DVDCost + PublicEnemy
Call CalculateTotalCost()
TextBox2.Text = "Total Cost inc. VAT & Delivery" & vbTab & "€" & TotalCostIncDel
End If
If ComboBox1.SelectedIndex = 3 Then
ListBox1.Items.Add(ComboBox1.SelectedItem & vbTab & " " & Quantity & " " & "@ €15.00" & vbTab & "Ready To Ship")
DVDCost = DVDCost + Blow
Call CalculateTotalCost()
TextBox2.Text = "Total Cost inc. VAT & Delivery" & vbTab & "€" & TotalCostIncDel
End If
If ComboBox1.SelectedIndex < 0 And ComboBox1.SelectedIndex > 4 Then
MessageBox.Show("Please Select A DVD", "Attention")
End If
_________________________________________________________________
Function CalculateTotalCost() As Decimal
TotalCostIncDel = DVDCost * Quantity
Return TotalCostIncDel
End Function
When I add single dvd's to the order it adds them fine and the total cost is correct but when i put the quantity of the dvd's to more than 1 its messes up the total cost.
E.G:
