Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Access the Data Rows Filtered by the BindingSource.Filter Property

0.00/5 (No votes)
16 Mar 2010 1  
I don't see any difficulty in finding the above solution, because I am using same functionality since long back. Here is my alternative code.Instead of creating a new DataView object, you can directly call the DataTable's DefaultView.sourceDataTable.DefaultView.RowFilter =...
I don't see any difficulty in finding the above solution, because I am using same functionality since long back. Here is my alternative code.

Instead of creating a new DataView object, you can directly call the DataTable's DefaultView.

sourceDataTable.DefaultView.RowFilter = bindingSource.Filter;
DataTable destinationDataTable = sourceDataTable.DefaultView.ToTable();


My alternative code will reduce a bit overhead of creating another DataView object. Am I right?

When our requirement is not updation of data, never create a new Data Table. Just create DataViews by setting RowFilter property as many as you want. This will reduce memory overhead on the system.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here