private void txtSearch_TextChanged(object sender, EventArgs e) { string keywords = txtSearch.Text; if (keywords != null) { DataTable dt = dal.search(keywords); dgvUsers.DataSource = dt; } else { DataTable dt = dal.select(); dgvUsers.DataSource = dt; } }
private void txtSearch_TextChanged(object sender, EventArgs e) { // get keywords from text box string keywords = txtSearch.Text; //check if keywords have value or not if (keywords != null) { //show user base on keyword DataTable dt = dal.search(keywords); dgvUser.DataSource = dt; } else { // show all user from database DataTable dt = dal.Select(); dgvUser.DataSource = dt; } }