Filter BindingSource wenn DataSource eine BindingList ist
Ich habe aus einem Excel-Sheet gelesen und dies für eine BindingList geschrieben, in Form_Load ist dies auf eine DataSource als BindingSource gesetzt:
bd = new BindingSource(); //instance of BindingSource
bd.DataSource = ExcelOPS.LerExcel(); //LerExcel() method return a BindingList<T>
gvFiltro.DataSource = bd; //set a DataGridView named gvFiltro DataSource property
bindNav.BindingSource = bd; //set a BindingNavigator source
Dies funktioniert gut! Ich beabsichtige, ein Kombinationsfeld als Filter für dieses DataGridView-gvFiltro zu erstellen. Daher versuche ich Folgendes im SelectedIndexChanged-Ereignis des Kombinationsfelds:
this.gvFiltro.DataSource = null;
bd.Filter = string.Format("TAG_FAZENDA like '%{0}%'", cbTagFaz.Text);
gvFiltro.DataSource = bd;
gvFiltro.Update();
gvFiltro.Refresh();
bindNav.BindingSource = bd;
bindNav.Update();
bindNav.Refresh();
Aber die DataGridView ändert sich nicht. Ich habe etwas verpasst