DataViews with DataSets

B

Bernie Hunt

I currently have a datagrid that I'm feeding with a DataSet, which contains
three tables. I would like to use a DataView to format the DataTables but
I'm not sure how to go about this.

Currently I have;

dsVendorContacts is a DataSet with three tables and relational links
dgVendors is a DataGrid

With dgVendors
.DataSource = dsVendorContacts
.DataMember = "wwVendors"
End With

If I create three DataViews, how do I attach the three seperate DataViews
to the grid and specify the main DataView?

Can I put DataViews into a DataSet?

Thanks,

Bernie
 
C

Cor Ligthert [MVP]

Bernie,

Every datatable has one dataview.
The name of that is the defaultview.

The dataview is nothing more than a class that holds things as a rowfilter,
a sort property and a collection of references to the dataviewrows (which
all have again a reference to a datarow).

Therefore you cannot handle it as a real table.

I hope this helps,

Cor
 
B

Bernie Hunt

Hi Cor!

So then, using my previous example, would I?

dsVendorContacts is a DataSet with three tables and relational links
dgVendors is a DataGrid

With dsVendorContacts.Tables("wwVendors").DefaultView
.Sort = "LastName ASC"
.AllowNew = False
End With

With dgVendors
.DataSource = dsVendorContacts
.DataMember = "wwVendors"
End With

And the sort and disallow would be in the grid when shown?

Sorry I'm away from my development station so I can't try out. It's
working on paper this morning.

Bernie
 
C

Cor Ligthert [MVP]

Bernie,

If I don't oversee something, yes.

Cor

Bernie Hunt said:
Hi Cor!

So then, using my previous example, would I?

dsVendorContacts is a DataSet with three tables and relational links
dgVendors is a DataGrid

With dsVendorContacts.Tables("wwVendors").DefaultView
.Sort = "LastName ASC"
.AllowNew = False
End With

With dgVendors
.DataSource = dsVendorContacts
.DataMember = "wwVendors"
End With

And the sort and disallow would be in the grid when shown?

Sorry I'm away from my development station so I can't try out. It's
working on paper this morning.

Bernie
 
C

Cor Ligthert [MVP]

Bernie,

I once had a problem with that, so I use forever.

dgVendors.DataSource = dsVendorContacts.Tables("wwVendors").DefaultView

There is than no need to set the member.

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