Relative Content

Tag Archive for c#data-bindingvisual-studio-2022listboxitemkiosk

Items are added to a listbox as well as the number of fillings. New items added makes the number of fillings for the other items the same

I have created kisok program in C#, Windows Forms that adds a sandwich name, price, and number of selected fillings to a listbox when that specific sandwiches picturebox has been clicked on. The problem im having is that for example, if the user selects 2 fillings for a cheese sandwich and adds it to the shopping cart, then chooses the cheese sandwich again but this time with 3 fillings, the number of fillings for the first added sandwich (within the listbox) will also be changed to having 3 fillings. (The fillings are added to each sandwich by selecting fillings from a textbox and then adding this to a separate listbox next to the sandwich image. The number of fillings for each sandwich is then calculated by assigning the number of items in the listbox to an objects parameter variable called fillingsAmount.)