void remove(string hotel,string price) { masterRef.Service1Client r = new masterRef.Service1Client(); bool deletion = r.deletefromcart(hotel); // Deteting the "Hotel-1" entry from the cart string cart = r.getitems(); // Getting the list of items in the cart from the cart service if (cart.Equals("empty")) // If the cart is empty { Label22.Text = "0"; ListBox1.Items.Clear(); // Clear the contents of the cart listbox } else { ListBox1.Items.Clear(); // Clear the listbox to update the cart string[] stringSeparators = new string[] { "-----------1----------" }; // to split the cart into items string[] stringSeparators1 = new string[] { "\n" }; string[] items = cart.Split(stringSeparators1, StringSplitOptions.RemoveEmptyEntries); // Current total value of cart is calculated here for (int i = 0; i < items.Length; i++) { ListBox1.Items.Add(items[i]); } //Label3.Text = sum.ToString(); // total is displayed } if ((Convert.ToInt32(Label22.Text) > 0) && deletion) Label22.Text = (Convert.ToInt32(Label22.Text) - Convert.ToInt32(price)).ToString(); }