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 5 3161
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
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" <ro**@bogus.Address.com> wrote in message
news:%2****************@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
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" <Da****@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.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
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" <Da****@discussions.microsoft.com> wrote in message news:54**********************************@microsof t.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
Daniel
Thanks, I will take a look at that.
Ron L
"Daniel" <Da****@discussions.microsoft.com> wrote in message
news:99**********************************@microsof t.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" <Da****@discussions.microsoft.com> wrote in message news:54**********************************@microsof t.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 >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pablo |
last post by:
Hi people,
Necesito crear n dataviews en tiempo de ejecucion.
I need to create "n" DataViews in runtime.
I tried creating an array this way:
Dim LDView As Array =...
|
by: Vee Kay |
last post by:
hi,
this is my first post here. i'm in desparate need of resources for
VC++.NET; the code in MSDN is only directed for VB/C#.. for C++ its
very few and faar in between!! the web is no good...
|
by: Kevin |
last post by:
I have a 4 tab form each with different dataviews attached to a datagrid. On
the last tab, I have a dataview attached to a datagrid and 2 comboxes that
are bound to the same dataset representing 2...
|
by: Terry McNamee |
last post by:
Hi Nicholas,
To give you a better understanding of what I'm doing...
I'm using a ownerdrawnlist control that is used as a menu on the smartphone.
To populate this menu, I iterate through the...
|
by: Jerry |
last post by:
Hi,
I have a couple of datagrids that are based on dataviews.
If I filter dataview1 I would like to automatically filter
dataview2. I posted something about this before but I
think I didn't...
|
by: Lars Netzel |
last post by:
hi!
myDataSet that is fillled from an Access 2000 db and includes ONE table
From that Table in myDataSet I create myDataView and use a Rowfilter to get
a few rows that i work with (i need a...
|
by: DraguVaso |
last post by:
Hi,
I have two DataTables (our DataViews or whatever that will suit the best for
the solution). I want to merge these two DataTables the fastest as possible,
but they have to be merged one table...
|
by: Bernie Hunt |
last post by:
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...
|
by: TomH |
last post by:
I am using VB within VS 2005. How can I have multiple datagridviews on the
same form pulling from the same table? e.g. I want to see all clients from
New York in one view and all clients from LA in...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |