public void BindCustomerComboBox() { try { /***************** Bind the Customer Combo*******************/ clsCustomerMaster objLoad = new clsCustomerMaster(); objLoad.Mode = "SELECTALL"; objLoad.CompanyID = cId; var dsCustomer = objLoad.GetAllCustomer(); DataTable dtCustomer = dsCustomer.Tables[0]; DataRow dr = dtCustomer.NewRow(); dr["CustomerID"] = "0"; dr["CustomerName"] = "All"; dtCustomer.Rows.InsertAt(dr, 0); cmbCustomer.DataSource = dtCustomer; cmbCustomer.DisplayMember = "CustomerName"; cmbCustomer.ValueMember = "CustomerID"; cmbCustomer.Text = "All"; /***************** Bind the Customer Combo*******************/ } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "BindCustomerComboBox", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void BindDataGrid() { try { clsCustomerMaster objLoad = new clsCustomerMaster(); objLoad.Mode = "SELECTALL"; objLoad.CompanyID = cId; dgvCustomerMaster.AutoGenerateColumns = false; var ds = objLoad.GetAllCustomer(); dgvCustomerMaster.DataSource = ds.Tables[0]; lblRecordCount.Text = ds.Tables[0].Rows.Count.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "BindDataGrid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }