private void LoadAutoCompleteClients() { txtSearch.AutoCompleteCustomSource.Clear(); foreach (DataRow dr in UserSearches.Get(frmMainParent.CurrentUser.UserId, "Accounts").Rows) { txtSearch.AutoCompleteCustomSource.Add(dr["SearchText"].ToString()); } }
private void txtSearchClnts_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; _pagination = new Pagination(dgvClients, Account.GetActiveCustomers(txtSearch.Text)); dgvClients.Columns[0].Visible = false; if (!String.IsNullOrWhiteSpace(txtSearch.Text)) { UserSearches.Insert(frmMainParent.CurrentUser.UserId, txtSearch.Text, "Accounts"); txtSearch.AutoCompleteCustomSource.Clear(); foreach (DataRow dr in UserSearches.Get(frmMainParent.CurrentUser.UserId, "Accounts").Rows) { txtSearch.AutoCompleteCustomSource.Add(dr["SearchText"].ToString()); } } } }