/// <summary> /// Robert Forbes /// 2017/03/30 /// /// Sets the default values for the fields in the window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmUpdateSuplierInvoice_Loaded(object sender, RoutedEventArgs e) { try { _supplierList = _supplierManager.ListSuppliers(); cboSupplier.ItemsSource = _supplierList; Supplier oldSupplier = _supplierList.Find(x => x.SupplierID.Equals(_invoice.SupplierId)); cboSupplier.SelectedIndex = cboSupplier.Items.IndexOf(oldSupplier); txtTotal.Text = _invoice.Total.ToString(); txtAmountPaid.Text = _invoice.AmountPaid.ToString(); txtSubTotal.Text = _invoice.SubTotal.ToString(); txtTaxAmount.Text = _invoice.TaxAmount.ToString(); dpInvoiceDate.SelectedDate = _invoice.InvoiceDate; } catch { MessageBox.Show("There was a problem communicating with the database"); } }