private void btnSearchCus_Click(object sender, EventArgs e)
        {
            DataTable tblCustomer = new DataTable();

            tblCustomer = customer_bus.Display("Select * from Customer where CustomerName like +'%" + txtSearchCus.Text + "%'");
            dataGridViewCustomer.DataSource = tblCustomer;
        }
Example #2
0
        private void CustomerManagement_Load(object sender, EventArgs e)
        {
            DataTable tblCustomer = new DataTable();

            tblCustomer = customer_bus.Display("Select *from  Customer");
            dataGridViewCustomer.DataSource         = tblCustomer;
            dataGridViewCustomer.AllowUserToAddRows = false;

            if (tblCustomer.Rows.Count == 0)
            {
                MessageBox.Show("There are no customers in list");
            }
            else
            {
                txtCID.Text      = dataGridViewCustomer.CurrentRow.Cells["CustomerID"].Value.ToString();
                txtCName.Text    = dataGridViewCustomer.CurrentRow.Cells["CustomerName"].Value.ToString();
                txtCPhone.Text   = dataGridViewCustomer.CurrentRow.Cells["PhoneNumber"].Value.ToString();
                txtCEmail.Text   = dataGridViewCustomer.CurrentRow.Cells["Email"].Value.ToString();
                txtCAddress.Text = dataGridViewCustomer.CurrentRow.Cells["Address"].Value.ToString();
            }
        }