public frmCreateInvoice() { InitializeComponent(); gParams.lastinvoice = tDAL.MaxInvoiceNumber(); txtInvNumber.Text = (gParams.lastinvoice + 1).ToString(); txtNonTaxable.Text = String.Format("{0:2}", "0"); txtSubTotal.Text = String.Format("{0:2}", "0"); txtSalesTax.Text = String.Format("{0:2}", "0"); txtGrandTotal.Text = String.Format("{0:2}", "0"); txtTaxRate.Text = Convert.ToString(gParams.taxrate); cbProduct.DataSource = Enum.GetValues(typeof(pName)); using SQLiteConnection conn = new SQLiteConnection(gParams.myConnection); { try { string query = "select id, name from tbl_customers"; SQLiteDataAdapter da = new SQLiteDataAdapter(query, conn); conn.Open(); DataSet ds = new DataSet(); da.Fill(ds, "tbl_customers"); cbCustomer.DataSource = ds.Tables["tbl_customers"]; cbCustomer.DisplayMember = "name"; cbCustomer.ValueMember = "id"; } catch (Exception ex) { // write exception info to log or anything else MessageBox.Show("Error occured! " + ex.StackTrace); } } }