/// <summary> /// Removes Items from Invoice /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRemoveItem_Click(object sender, RoutedEventArgs e) { try { //Check to make sure item is selected if (addedItem.Equals(" ") || addedItem.Equals(null)) { return; } string itemDesc = cmbxItemsAdded.SelectedItem.ToString(); //Remove item addeditems.Remove(itemDesc); string itemCode = ml.getItemCode(itemDesc); //Subtract removed item from total double cost; cost = ml.getItemCost(itemCode); total -= cost; //Remove Item from Invoice ml.DeleteItemFromInvoice(InvoiceNum, itemCode); //Clear ComboBox Added Items cmbxItemsAdded.ClearValue(ItemsControl.ItemsSourceProperty); //Reload Added Items to ComboBox cmbxItemsAdded.ItemsSource = addeditems; //Clear Selected cmbxItemsAdded.SelectedIndex = -1; //Disable Remove Button btnRemoveItem.IsEnabled = false; //Change Total txtbxTotalCost.Text = "$ " + String.Format("{0:N2}", total); } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }