コード例 #1
0
 private void frmInvoice_Load(object sender, EventArgs e)
 {
     try
     {
         DataTable dtProducts = _repoProduct.GetAllProducts();
         dtpInvoiceDate.MaxDate = DateTime.Now; //Minimum Date is today
         //dtpInvoiceDate.MinDate = DateTime.Now.AddMonths(1); //Maximum Date is 1 month from today
         Int64 InvoiceNo = _repoInvoice.getInvoiceIdentity() + 1;
         txtInvoiceNo.Text = InvoiceNo.ToString();
         AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection();
         foreach (DataRow row in dtProducts.Rows)
         {
             MyCollection.Add(row["Name"].ToString() + "|" + row["ProductId"].ToString());
         }
         //AutoCompleteStringCollection data = new AutoCompleteStringCollection();
         //data.Add("Mahesh Chand");
         //data.Add("Mac Jocky");
         //data.Add("Millan Peter");
         txtProductName.AutoCompleteCustomSource = MyCollection;
         GridStructure();
         dataGridView1.Height = 400;
         txtProductName.Focus();
         cmbCashCard.SelectedIndex = cmbCashCard.FindStringExact("Cash");
     }
     catch (Exception ex)
     {
         _errorLogs.LogErrors("frmInvoice", "frmInvoice_Load", ex.Message);
     }
     finally
     {
     }
 }