I have a DataTable that is being maintained in a Model class. I also have a
View class which creates a DataView from the DataTable that the Model passes
it. The view class then has methods to filter the contents of the DataView
so that the user can narrow down the list to the items they are interested
in. This all works fine as long as I only have a single instance of the
View class, however whenever I create a second instance of the view class
and have it make its DataView use the same DataTable I find that any filter
applied to the DataView in one window is also applied to the DataView in the
other form. Can anyone explain this to me? It seems that as long as I am
using 2 independant DataViews (dim dv as new DataView(model.GetTable()) they
shouldn't interact.

TIA
Ron L

RE: Multiple DataViews on the same DataTable appear to interact by Daniel

Daniel
Tue Sep 27 13:45:02 CDT 2005

Ron,
The problem is that all the views are connected to the same table. To avoid
this, when creating additional views, create the main table from your Model
class and use separate copy of this table for each view:

dim t2 as Datatable = tMain.Copy
dim dv2 = t2.DefaultView
DataGrid2.DataSource = dv2

This way each view is connected to a different table and filtering one will
not affect the others.

Hope that helps,
Daniel

"Ron L" wrote:

> I have a DataTable that is being maintained in a Model class. I also have a
> View class which creates a DataView from the DataTable that the Model passes
> it. The view class then has methods to filter the contents of the DataView
> so that the user can narrow down the list to the items they are interested
> in. This all works fine as long as I only have a single instance of the
> View class, however whenever I create a second instance of the view class
> and have it make its DataView use the same DataTable I find that any filter
> applied to the DataView in one window is also applied to the DataView in the
> other form. Can anyone explain this to me? It seems that as long as I am
> using 2 independant DataViews (dim dv as new DataView(model.GetTable()) they
> shouldn't interact.
>
> TIA
> Ron L
>
>
>

Re: Multiple DataViews on the same DataTable appear to interact by Ron

Ron
Tue Sep 27 13:45:47 CDT 2005

Some further, amplifying information, the interaction we are seeing is with
datagrids on each form, each bound to its own dataview.

TIA
Ron L

"Ron L" <ronl@bogus.Address.com> wrote in message
news:%23GoxuB5wFHA.3860@TK2MSFTNGP09.phx.gbl...
>I have a DataTable that is being maintained in a Model class. I also have
>a View class which creates a DataView from the DataTable that the Model
>passes it. The view class then has methods to filter the contents of the
>DataView so that the user can narrow down the list to the items they are
>interested in. This all works fine as long as I only have a single
>instance of the View class, however whenever I create a second instance of
>the view class and have it make its DataView use the same DataTable I find
>that any filter applied to the DataView in one window is also applied to
>the DataView in the other form. Can anyone explain this to me? It seems
>that as long as I am using 2 independant DataViews (dim dv as new
>DataView(model.GetTable()) they shouldn't interact.
>
> TIA
> Ron L
>
>



Re: Multiple DataViews on the same DataTable appear to interact by Ron

Ron
Tue Sep 27 14:05:06 CDT 2005

Daniel

Thanks for the response. The problem with keeping multiple copies is that
the tables can be updated, and I want to be able to perform the update in
one place. I suppose, if I have to, I can keep track of the copies in a
central location and perform the update on all of them whenever it happens.
I was hoping that I wouldn't need to add that complexity.

Ron L
"Daniel" <Daniel@discussions.microsoft.com> wrote in message
news:54C0ED57-7EB0-4850-828F-6B7DB5660868@microsoft.com...
> Ron,
> The problem is that all the views are connected to the same table. To
> avoid
> this, when creating additional views, create the main table from your
> Model
> class and use separate copy of this table for each view:
>
> dim t2 as Datatable = tMain.Copy
> dim dv2 = t2.DefaultView
> DataGrid2.DataSource = dv2
>
> This way each view is connected to a different table and filtering one
> will
> not affect the others.
>
> Hope that helps,
> Daniel
>
> "Ron L" wrote:
>
>> I have a DataTable that is being maintained in a Model class. I also
>> have a
>> View class which creates a DataView from the DataTable that the Model
>> passes
>> it. The view class then has methods to filter the contents of the
>> DataView
>> so that the user can narrow down the list to the items they are
>> interested
>> in. This all works fine as long as I only have a single instance of the
>> View class, however whenever I create a second instance of the view class
>> and have it make its DataView use the same DataTable I find that any
>> filter
>> applied to the DataView in one window is also applied to the DataView in
>> the
>> other form. Can anyone explain this to me? It seems that as long as I
>> am
>> using 2 independant DataViews (dim dv as new DataView(model.GetTable())
>> they
>> shouldn't interact.
>>
>> TIA
>> Ron L
>>
>>
>>



Re: Multiple DataViews on the same DataTable appear to interact by Daniel

Daniel
Tue Sep 27 20:13:01 CDT 2005

Ron,

Maybe you can work around this by refreshing the datasource views for each
datagrid everytime the user updates the main database. You don't need to keep
track of the multiple copies, just create the new copy, and pass its default
dataview to the datagrid as datasource each time the user updates the
database.
I am not sure if that will fit your needs, but I used it to solve a similiar
problem and it worked fine.

Daniel

"Ron L" wrote:

> Daniel
>
> Thanks for the response. The problem with keeping multiple copies is that
> the tables can be updated, and I want to be able to perform the update in
> one place. I suppose, if I have to, I can keep track of the copies in a
> central location and perform the update on all of them whenever it happens.
> I was hoping that I wouldn't need to add that complexity.
>
> Ron L
> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
> news:54C0ED57-7EB0-4850-828F-6B7DB5660868@microsoft.com...
> > Ron,
> > The problem is that all the views are connected to the same table. To
> > avoid
> > this, when creating additional views, create the main table from your
> > Model
> > class and use separate copy of this table for each view:
> >
> > dim t2 as Datatable = tMain.Copy
> > dim dv2 = t2.DefaultView
> > DataGrid2.DataSource = dv2
> >
> > This way each view is connected to a different table and filtering one
> > will
> > not affect the others.
> >
> > Hope that helps,
> > Daniel
> >
> > "Ron L" wrote:
> >
> >> I have a DataTable that is being maintained in a Model class. I also
> >> have a
> >> View class which creates a DataView from the DataTable that the Model
> >> passes
> >> it. The view class then has methods to filter the contents of the
> >> DataView
> >> so that the user can narrow down the list to the items they are
> >> interested
> >> in. This all works fine as long as I only have a single instance of the
> >> View class, however whenever I create a second instance of the view class
> >> and have it make its DataView use the same DataTable I find that any
> >> filter
> >> applied to the DataView in one window is also applied to the DataView in
> >> the
> >> other form. Can anyone explain this to me? It seems that as long as I
> >> am
> >> using 2 independant DataViews (dim dv as new DataView(model.GetTable())
> >> they
> >> shouldn't interact.
> >>
> >> TIA
> >> Ron L
> >>
> >>
> >>
>
>
>

Re: Multiple DataViews on the same DataTable appear to interact by Ron

Ron
Wed Sep 28 06:14:44 CDT 2005

Daniel

Thanks, I will take a look at that.

Ron L

"Daniel" <Daniel@discussions.microsoft.com> wrote in message
news:99D1886D-1063-4160-9706-ED8DB45E8CCF@microsoft.com...
> Ron,
>
> Maybe you can work around this by refreshing the datasource views for each
> datagrid everytime the user updates the main database. You don't need to
> keep
> track of the multiple copies, just create the new copy, and pass its
> default
> dataview to the datagrid as datasource each time the user updates the
> database.
> I am not sure if that will fit your needs, but I used it to solve a
> similiar
> problem and it worked fine.
>
> Daniel
>
> "Ron L" wrote:
>
>> Daniel
>>
>> Thanks for the response. The problem with keeping multiple copies is
>> that
>> the tables can be updated, and I want to be able to perform the update in
>> one place. I suppose, if I have to, I can keep track of the copies in a
>> central location and perform the update on all of them whenever it
>> happens.
>> I was hoping that I wouldn't need to add that complexity.
>>
>> Ron L
>> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
>> news:54C0ED57-7EB0-4850-828F-6B7DB5660868@microsoft.com...
>> > Ron,
>> > The problem is that all the views are connected to the same table. To
>> > avoid
>> > this, when creating additional views, create the main table from your
>> > Model
>> > class and use separate copy of this table for each view:
>> >
>> > dim t2 as Datatable = tMain.Copy
>> > dim dv2 = t2.DefaultView
>> > DataGrid2.DataSource = dv2
>> >
>> > This way each view is connected to a different table and filtering one
>> > will
>> > not affect the others.
>> >
>> > Hope that helps,
>> > Daniel
>> >
>> > "Ron L" wrote:
>> >
>> >> I have a DataTable that is being maintained in a Model class. I also
>> >> have a
>> >> View class which creates a DataView from the DataTable that the Model
>> >> passes
>> >> it. The view class then has methods to filter the contents of the
>> >> DataView
>> >> so that the user can narrow down the list to the items they are
>> >> interested
>> >> in. This all works fine as long as I only have a single instance of
>> >> the
>> >> View class, however whenever I create a second instance of the view
>> >> class
>> >> and have it make its DataView use the same DataTable I find that any
>> >> filter
>> >> applied to the DataView in one window is also applied to the DataView
>> >> in
>> >> the
>> >> other form. Can anyone explain this to me? It seems that as long as
>> >> I
>> >> am
>> >> using 2 independant DataViews (dim dv as new
>> >> DataView(model.GetTable())
>> >> they
>> >> shouldn't interact.
>> >>
>> >> TIA
>> >> Ron L
>> >>
>> >>
>> >>
>>
>>
>>