Results 1 to 2 of 2

Thread: Reverse cost added earlier

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    8

    Reverse cost added earlier

    I have i remove button in my program which removes a selected item from the list box. But i don't know how can i get the program to remove the selected item along with subtracting the cost of that item when i click on the remove button.
    This is my code for the remove button.

    listbox1.Items.Remove(listbox1.Text)

    This is the code i used to add the cost of selected items in the listbox and this code is in a module.

    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"}

    Public RegularPizza As Double = 8.5
    Public GourmetPizza As Double = 13.5
    Dim TotalDelivery As Double = 3.0

    For x As Integer = 0 To (listbox1.Items.Count - 1)
    If listbox1.Items(x) = Pizza(0) Or listbox1.Items(x) = Pizza(1) Or listbox1.Items(x) = Pizza(2) Or listbox1.Items(x) = Pizza(3) Or listbox1.Items(x) = Pizza(4) Then
    TotalDelivery += RegularPizza
    Else
    TotalDelivery += GourmetPizza
    End If
    Next

    label1.Text = TotalDelivery.ToString("C")

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Reverse cost added earlier

    Recalculate after the item is removed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width