I have a Listbox which adds an item that the user wishes to purchase. Each item contains a price. When a user adds an item to cart, the program adds the price to the total paymet. When the user removes item from cart, the program subtracts the price of the item from the cart. I have boot items of $15 and $10. When a list item is added, the name and price of boot is displayed in string format.
eg. cart.Items.Add("boot1 costs" + $10);
However, I would like link numerical values with each items purchased. So that it adds the price to the total payment to generate a receipt in the end.
Name,Priceand override itsToString()method to return desired string format, Then when you want to add an item toListBoxand an instance of this class. Or as an alternative useDataTable. - Reza Aghaei