Hello everyone. I have been assigned as a "Final" to code a Visual Basic program that takes concession stand orders, adds the items to a list, then figures the change.
This is a picture of the interface I designed to give you all the right idea.
This code works to a point. It adds the $2.00 in the total box, but keeps it there even if I press the "add" button next to "hamburger" again. I would like that total to stack every time I press the button so it keeps a running total of everything purchased(and go on when I add other items, like "pizza" to the listbox).Code:Private Sub xAddHamburgerButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xAddHamburgerButton.Click Dim total As Double Double.TryParse(Me.xTotalLabel.Text, total) total = total + 2 Me.xTotalLabel.Text = total.ToString("C2") Me.xItemsListBox.Items.Add("Hamburger $2.00") End Sub
Also this code isn't doing what is desired.
This picture demonstrates what happens:Code:Private Sub xChangeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xChangeButton.Click Dim amount As Integer Dim total As Integer Dim change As Integer Integer.TryParse(Me.xAmountRecievedTextBox.Text, amount) Integer.TryParse(Me.xTotalLabel.Text, total) Integer.TryParse(Me.xChangeLabel.Text, change) change = amount - total Me.xChangeLabel.Text = change.ToString("C2") End Sub
And one last thing. What code would I use to make it remove a selected item from the list box? (xItemsListBox)
Any help would be greatly appreciated. Sorry if I sound like a newbie... but I am.![]()






Reply With Quote