public void loadcustomer() { flowLayoutPanel1.Controls.Clear(); DataTable a = CustomersDAO.Instance.Customerslist(); for (int i = 0; i < a.Rows.Count; i++) { UC_ItemCustomer item = new UC_ItemCustomer(this); item.makh = a.Rows[i]["makh"].ToString(); item.tenkh = a.Rows[i]["ten_kh"].ToString(); item.sdt = a.Rows[i]["dien_thoai"].ToString(); item.gioitinh = a.Rows[i]["gioi_tinh"].ToString(); item.diachi = a.Rows[i]["dia_chi"].ToString(); item.set_UC(); flowLayoutPanel1.Controls.Add(item); } }
private void guna2TextBox1_TextChanged(object sender, EventArgs e) { if (tb_search.Text == "") { loadcustomer(); } else { flowLayoutPanel1.Controls.Clear(); DataTable a = CustomersDAO.Instance.search_customer_by_name(tb_search.Text); for (int i = 0; i < a.Rows.Count; i++) { UC_ItemCustomer item = new UC_ItemCustomer(this); item.makh = a.Rows[i]["makh"].ToString(); item.tenkh = a.Rows[i]["ten_kh"].ToString(); item.sdt = a.Rows[i]["dien_thoai"].ToString(); item.gioitinh = a.Rows[i]["gioi_tinh"].ToString(); item.diachi = a.Rows[i]["dia_chi"].ToString(); item.set_UC(); flowLayoutPanel1.Controls.Add(item); } } }