diff --git a/BealeEngineering/BealeEngineering.Accounts/frmMain.cs b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs index 09bfed2..e440de6 100644 --- a/BealeEngineering/BealeEngineering.Accounts/frmMain.cs +++ b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs @@ -78,9 +78,20 @@ namespace BealeEngineering.Accounts private void cmbInvoicePick_SelectedIndexChanged(object sender, EventArgs e) { var invoiceHeader = (Core.Model.Sale.InvoiceHeader)cmbInvoicePick.SelectedItem; - txtInvoiceContact.Text = invoiceHeader.ContactName; - txtInvoiceNetAmount.Text = (invoiceHeader.InvoiceTotal - invoiceHeader.TaxTotal).ToString("F") + " " + invoiceHeader.CurrencyCode; - txtInvoiceStatus.Text = invoiceHeader.Status; + if (invoiceHeader != null) + { + cmbInvoicePick.Enabled = true; + txtInvoiceContact.Text = invoiceHeader.ContactName; + txtInvoiceNetAmount.Text = (invoiceHeader.InvoiceTotal - invoiceHeader.TaxTotal).ToString("F") + " " + invoiceHeader.CurrencyCode; + txtInvoiceStatus.Text = invoiceHeader.Status; + } + else + { + cmbInvoicePick.Enabled = false; + txtInvoiceContact.Text = ""; + txtInvoiceNetAmount.Text = ""; + txtInvoiceStatus.Text = ""; + } } private void UpdateInvoiceCombo()