private void txtSearchFilter_TextChanged(object sender, EventArgs e) { if (txtSearchFilter.Text == "") { if (dv != null) { dv.RowFilter = ""; } } if (cmbSearch.SelectedIndex > -1) { if (dv != null) { SearchColumns col = (cmbSearch.SelectedItem as SearchColumns); dv.RowFilter = string.Format("{0} like '%{1}%' OR {0} like '%{2}%'", col.name, txtSearchFilter.Text.RemoveArabicKaf(), txtSearchFilter.Text.RemoveArabicKaf().ReplaceWithArabicYa()); } } }
public FormMain() { InitializeComponent(); bll = new BLL(); LoadDoreList(); cmbSearch.DataSource = SearchColumns.GetColumns(); if (!string.IsNullOrEmpty(Properties.Settings.Default.LastSearchFilter)) { int i = -1; foreach (var item in cmbSearch.Items) { i++; if ((item as SearchColumns).name == Properties.Settings.Default.LastSearchFilter) { cmbSearch.SelectedIndex = i; break; } } } }