Hello all!
I am in the process of creating a restaurant application that lets the user select an item from a menu list (a listbox) and on a press of a button the selected item from the listbox transfers to to my current orders list (multicolumn listview, 3 columns; foodname, quantity and price [per item price*quantity]). After which the preceding calculations and quantity input functions are done in order to fill in the other columns of the selected index.
So for a little error handling what I would like to do is if ever the user selects an item from the listbox that is already present in the listview, I would just update the duplicate of the item in the listview with the proper data. That is, if he selects foodA from the listbox, while foodA was already present in my listview, I would just update the quantity and current price of the item.
With that in mind I just thought of using the finditemwithtext method.
After implementation I think I was successful in searching for the item but my problem now is how do I select the index (or the item itself) of the item that was found so that I could just overwrite it and redo the calculations again?
Rephrasing the previous paragraph: What I thought of was just to search the listview if the current item exists, if the method returns true, I would just select the index of the item found to be a duplicate and implement the calculations.
Here is a snippet of the searching code:
string currentItem = Convert.ToString(menuList.SelectedItem);
if (currentItem == Convert.ToString(orderList.FindItemWithText(currentItem)))
{
//whatnow?
}