DataView

  • Thread starter Thread starter hzgt9b
  • Start date Start date
H

hzgt9b

Using VS2005, VB.NET,
I know that I can use a DataView to constrain what rows are "seen"
from the underlying datatable - is it also possible to use a DataView
to constrain what columns/attributes "seen" from the underlying
datatable? If so, can you point me to an example.

Thanks for your attention to this...
 
As far as I know, you would have to create a separate datatable for each
possible set of columns you want to view. You can use the DataViewManager to
point a single dataview to each datatable, (assuming you add the datatables
to a dataset), then apply the row filter.

Use
MyDataView.DataViewManager.DataSet = MyDataSet
to point to the dataset that contains the DataTables.

Use
Dim dvs As DataViewSetting = MyDataView.DataViewManager. _
DataViewSettings("MyTableName") '(overloaded with 3 parameter types)
to point to the datatable containing the columns you want viewed,

Then Use
dvs.rowfilter = your selection criteria
to apply a rowfilter to the DataViewSetting's underlying DataView.
 
Another possibility, if your users are viewing the DataView through a
DataGrid, would be to dynamically add and remove columns from the grid, or
dynamically resize the columns you want to exclude to zero.
 
Hi,

This has a simple answer, "No". There is in fact no need for that, because
all controls have the possibility to filter the columns. Beside that you can
create in the versions after 2003 a not dynamic copy of a datatable using
the dataview overloaded method for that.

Cor
 
Back
Top