private void FrmMoein_Load(object sender, EventArgs e) { try { Set_Data(); var moeins = MoeinBussines.GetAll().ToList(); AutoCompleteStringCollection _source = new AutoCompleteStringCollection(); foreach (var item in moeins) { _source.Add(item.Name); } txtName.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtName.AutoCompleteSource = AutoCompleteSource.CustomSource; txtName.AutoCompleteCustomSource = _source; ToolTip tt = new ToolTip(); tt.SetToolTip(btnSearchKol, "انتخاب حساب کل"); } catch (Exception exception) { frmMessage f = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message); f.ShowDialog(); } }
private void LoadData(string search = null) { try { if (search == null) { var lst = MoeinBussines.GetAll().Where(q => q.Status).OrderBy(q => q.Code).ToList(); MoeinBindingSource.DataSource = lst.ToList(); } else { var list = MoeinBussines.Search(search).Where(q => q.Status).ToList(); MoeinBindingSource.DataSource = list; } lblCounter.Text = MoeinBindingSource.Count.ToString(); } catch (Exception exception) { frmMessage frm = new frmMessage(EnumMessageFlag.ShowFlag, Color.Red, exception.Message); frm.ShowDialog(); } }