private void FrmKol_Load(object sender, EventArgs e) { try { Set_Data(); var kols = KolBussines.GetAll().ToList(); AutoCompleteStringCollection _source = new AutoCompleteStringCollection(); foreach (var item in kols) { _source.Add(item.Name); } txtName.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtName.AutoCompleteSource = AutoCompleteSource.CustomSource; txtName.AutoCompleteCustomSource = _source; } catch (Exception exception) { frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message); f.ShowDialog(); } }
public void LoadData(string search = "") { try { if (search == "") { var lst = KolBussines.GetAll().Where(q => q.Status).OrderBy(q => q.Code).ToList(); KolBindingSource.DataSource = lst.ToList(); } else { var list = KolBussines.Search(search).Where(q => q.Status).OrderBy(q => q.Code).ToList(); KolBindingSource.DataSource = list; } lblCounter.Text = KolBindingSource.Count.ToString(); } catch (Exception exception) { frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message); frm.ShowDialog(); } }