开发者

Filtering DataGridview using DataSet -> BindingSource, extra columns later added

For a WinForms VB.Net application, I use the Bindingsource's filtering capacity to filter data, which is seen in a DataGridview. The BindingSource is from a DataSet, created using the Designer, and the data comes from a Access DB, using JetEngine and .Net 3.5. So basically:

Datagridview.Datasource = xxBindingSource
xxBindingsource.Filter = "[extended filter string with multiple columns]"

This filtering works fine, however, now I included some extra columns in the DataGridView, which I'd like to filter on, too. Of course, when I feed the manually added columns to the Filter of the BindingSource, this doesn't work out.

I've done some research, and was not able to find any way to use the BindingSource's filtering syntax on the DataGr开发者_JS百科idview. I'd like to use this syntax though, as I designed quite a nice UserControl and class around it, to provide smooth, fast and simple filtering capabilities. Any suggestions here?

Another option would be to rewrite this part, and use some other form of filtering. Can anyone point me to some best practices?


Actually, Jack got it right! I learned about the DataColumn.Expression and about adding a column to the DataTable in the DataSet, which didn't affect the TableAdapter. So I did just that. Great, thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜