Listbox and Subtotal Help

sarge_rob2002

New member
Joined
Oct 6, 2005
Messages
1
Programming Experience
Beginner
I'm writing an order form applicaiton. The idea is to tave two texboxes.. One with a list of all items for sale. The other for items that the user selects by double clicking or using the ADD button. For right now, all 4 of the items are $5.

All the items have been set as:
Me.lstItems.Items.AddRange(New Object() {"6 pk Tennis Balls", "8 oz Retriever glass", "8 pk beef bones", "12 inch leather collar"})

The problem I am having and need help on is this. I need to add all the selected items together for a subtotal textbox. I want to use a For ... next Loop. I need separate lines for each item so I can change the prices when needed.

Can you please help me!
 
The way you are doing this is way too basic to scale up to anything like a real-life situation. If it's just a project that you're playing with to learn concepts then that's cool, but if you really want to use it in anger then I suggest you rethink your design. For one thing, if the user wants more than one of the same item they will have to add it to your ListBox more than once, rather than having just one entry with an item name and a quantity. Basically, all the data for each item should be a record in a database table. You would then have a table that contained order records and another that contained records corresponding to each item in an order, with fields for item ID, order ID, price, quantity, etc. As you're doing it, you just need to loop over the Items property of the ListBox and add $5 each time, or have some variable somewhere that represents the price of that item and add it to the total each time.
 
Back
Top