Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / Visual Basic
Alternative
Tip/Trick

Access the Data Rows Filtered by the BindingSource.Filter Property

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
16 Mar 2010CPOL 7.5K   3  
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --