I have a system where once a button is clicked a food item is added to Listbox1 and its price is added to Listbox2. I'm trying to create a button where the user can delete the food item and its price will be deleted.
I'm very new to this but I gave it a go at trying to achieve this task with my code below. The item deletes fine but the first price in the list is deleted, not the price of the item. This is a problem when there are multiple items. The program also crashes if there are no prices
If anyone could help that would be great, cheers
Dim itemdel As Integer
itemdel = ListBox1.SelectedValue
ListBox2.Items.RemoveAt(itemdel)
ListBox1.Items.Remove(ListBox1.SelectedItem)