DataView

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...
 
G

Guest

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.
 
G

Guest

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.
 
C

Cor Ligthert[MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top