filter binding source or bindinglist with textbox_keypress

空扰寡人 提交于 2019-12-24 03:21:22

问题


I use winforms and c#.

How can I filter Binding source or binding list. with a textbox text ? I meam while I am typing in a textbox my grid is filtering with a %Like method not (=,equal)method.

thanks.


回答1:


I use delegate for this problem. Some code like bellow

        _List = _List.FindAll(
            delegate(MyEntity entity)
            {
                return entity.Title.Contains(TXT_Title.Text);
            }
        );
        Gview.DataSource = _List  ;



回答2:


You may want to use CollectionViewSource class to enable filtering.

See here



来源:https://stackoverflow.com/questions/4532928/filter-binding-source-or-bindinglist-with-textbox-keypress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!