473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

One dataset, two datagrid

I got one dataset, one datatable, but two datagrids.
I use dataview.rowfilter = 'sex ="F" and dataview.rowfilter = 'sex ="M" to
filter the information
and set to two datagrids's datasource = dataview (one is F , other is M)
However , it doesn't work ..
Please help
Nov 21 '05 #1
8 2667
Agnes,

Normally that should work, when you use the right quotes.

\\\
dvF.rowfilter = "sex = 'F'"
dvM.rowfilter = "sex = 'M'"
dgF.datasource = dvF
dgM.datasource = dvM
///

That should work, and give a reply if when it does , I get the idea you
seldom do that.

Cor
Nov 21 '05 #2
I've had this same problem with ListBox controls. I had to create 2 copies
of the dataset because it uses the datasets cursor to determine certain
values.

Unless the datagrid makes its own copy of the dataset... Then you can
reference the same one, otherwise, a change in position in the datagrid will
cause a change in position on the underlying dataset.

this includes filtering..
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:eV*************@TK2MSFTNGP09.phx.gbl...
I got one dataset, one datatable, but two datagrids.
I use dataview.rowfilter = 'sex ="F" and dataview.rowfilter = 'sex ="M" to
filter the information
and set to two datagrids's datasource = dataview (one is F , other is M)
However , it doesn't work ..
Please help

Nov 21 '05 #3
I try your codes, it doesn't work.
It only work for one datagrid in one windowform,
Now, mysolution is One Table, Two datasets, Two datagrids, one Dataset per
one datagrid.

"Cor Ligthert" <no************@planet.nl> ¦b¶l¥ó
news:uA**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Agnes,

Normally that should work, when you use the right quotes.

\\\
dvF.rowfilter = "sex = 'F'"
dvM.rowfilter = "sex = 'M'"
dgF.datasource = dvF
dgM.datasource = dvM
///

That should work, and give a reply if when it does , I get the idea you
seldom do that.

Cor

Nov 21 '05 #4
Agnes,

That was not code that was a snippet

Here a sample code, what I tested, however the same as the snippet.

It gives the longtime regulars from the US and the EU in different datagrid.

\\\It only needs 2 datagrids on a form
Private dtVBreg As DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
CreateTables()
Dim dvEU As New DataView(dtVBreg)
Dim dvUS As New DataView(dtVBreg)
dvEU.RowFilter = "Country = 'EU'"
dvUS.RowFilter = "Country = 'US'"
DataGrid1.DataSource = dvEU
DataGrid2.DataSource = dvUS
End Sub
Private Sub CreateTables()
Dim drel As DataRelation

dtVBreg = New DataTable("Persons")
dtVBreg.Columns.Add("Name")
dtVBreg.Columns.Add("Country")
For i As Integer = 0 To 7
dtVBreg.Rows.Add(dtVBreg.NewRow)
Next
dtVBreg.Rows(0).ItemArray = New Object() _
{"Herfried K. Wagner", "EU"}
dtVBreg.Rows(1).ItemArray = New Object() _
{"Ken Tucker", "US"}
dtVBreg.Rows(2).ItemArray = New Object() _
{"CJ Taylor", "US"}
dtVBreg.Rows(3).ItemArray = New Object() _
{"Jay B Harlow", "US"}
dtVBreg.Rows(4).ItemArray = New Object() _
{"Terry Burns", "EU"}
dtVBreg.Rows(5).ItemArray = New Object() _
{"Tom Shelton", "US"}
dtVBreg.Rows(6).ItemArray = New Object() _
{"Cor Ligthert", "EU"}

End Sub

I will be glad to hear if this works or not?

Cor
I try your codes, it doesn't work.
It only work for one datagrid in one windowform,
Now, mysolution is One Table, Two datasets, Two datagrids, one Dataset
per
one datagrid.

"Cor Ligthert" <no************@planet.nl> ¦b¶l¥ó
news:uA**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Agnes,

Normally that should work, when you use the right quotes.

\\\
dvF.rowfilter = "sex = 'F'"
dvM.rowfilter = "sex = 'M'"
dgF.datasource = dvF
dgM.datasource = dvM
///

That should work, and give a reply if when it does , I get the idea you
seldom do that.

Cor


Nov 21 '05 #5
woot!

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
Agnes,

That was not code that was a snippet

Here a sample code, what I tested, however the same as the snippet.

It gives the longtime regulars from the US and the EU in different datagrid.
\\\It only needs 2 datagrids on a form
Private dtVBreg As DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
CreateTables()
Dim dvEU As New DataView(dtVBreg)
Dim dvUS As New DataView(dtVBreg)
dvEU.RowFilter = "Country = 'EU'"
dvUS.RowFilter = "Country = 'US'"
DataGrid1.DataSource = dvEU
DataGrid2.DataSource = dvUS
End Sub
Private Sub CreateTables()
Dim drel As DataRelation

dtVBreg = New DataTable("Persons")
dtVBreg.Columns.Add("Name")
dtVBreg.Columns.Add("Country")
For i As Integer = 0 To 7
dtVBreg.Rows.Add(dtVBreg.NewRow)
Next
dtVBreg.Rows(0).ItemArray = New Object() _
{"Herfried K. Wagner", "EU"}
dtVBreg.Rows(1).ItemArray = New Object() _
{"Ken Tucker", "US"}
dtVBreg.Rows(2).ItemArray = New Object() _
{"CJ Taylor", "US"}
dtVBreg.Rows(3).ItemArray = New Object() _
{"Jay B Harlow", "US"}
dtVBreg.Rows(4).ItemArray = New Object() _
{"Terry Burns", "EU"}
dtVBreg.Rows(5).ItemArray = New Object() _
{"Tom Shelton", "US"}
dtVBreg.Rows(6).ItemArray = New Object() _
{"Cor Ligthert", "EU"}

End Sub

I will be glad to hear if this works or not?

Cor
I try your codes, it doesn't work.
It only work for one datagrid in one windowform,
Now, mysolution is One Table, Two datasets, Two datagrids, one Dataset
per
one datagrid.

"Cor Ligthert" <no************@planet.nl> ¦b¶l¥ó
news:uA**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Agnes,

Normally that should work, when you use the right quotes.

\\\
dvF.rowfilter = "sex = 'F'"
dvM.rowfilter = "sex = 'M'"
dgF.datasource = dvF
dgM.datasource = dvM
///

That should work, and give a reply if when it does , I get the idea you
seldom do that.

Cor



Nov 21 '05 #6
> woot!

Do you believe I understand that, with some more words around it maybe I
could, is this indian language?

Cor
Nov 21 '05 #7
Perhaps this is just an American programmer thing.

Or maybe just between my programming cohorts...

Can I get a woot woot!?

I used it because I made the Dataset list.. and that made me happy.

is this indian language?


Nov 21 '05 #8
I have a form with 1 dset, 1 dtbl and 2 dviews and 2 dgrids. Works fine. I
don't see why your example shouldn't work. Can't you try it yourself?
Frank

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:eb**************@TK2MSFTNGP11.phx.gbl...
woot!

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
Agnes,

That was not code that was a snippet

Here a sample code, what I tested, however the same as the snippet.

It gives the longtime regulars from the US and the EU in different

datagrid.

\\\It only needs 2 datagrids on a form
Private dtVBreg As DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
CreateTables()
Dim dvEU As New DataView(dtVBreg)
Dim dvUS As New DataView(dtVBreg)
dvEU.RowFilter = "Country = 'EU'"
dvUS.RowFilter = "Country = 'US'"
DataGrid1.DataSource = dvEU
DataGrid2.DataSource = dvUS
End Sub
Private Sub CreateTables()
Dim drel As DataRelation

dtVBreg = New DataTable("Persons")
dtVBreg.Columns.Add("Name")
dtVBreg.Columns.Add("Country")
For i As Integer = 0 To 7
dtVBreg.Rows.Add(dtVBreg.NewRow)
Next
dtVBreg.Rows(0).ItemArray = New Object() _
{"Herfried K. Wagner", "EU"}
dtVBreg.Rows(1).ItemArray = New Object() _
{"Ken Tucker", "US"}
dtVBreg.Rows(2).ItemArray = New Object() _
{"CJ Taylor", "US"}
dtVBreg.Rows(3).ItemArray = New Object() _
{"Jay B Harlow", "US"}
dtVBreg.Rows(4).ItemArray = New Object() _
{"Terry Burns", "EU"}
dtVBreg.Rows(5).ItemArray = New Object() _
{"Tom Shelton", "US"}
dtVBreg.Rows(6).ItemArray = New Object() _
{"Cor Ligthert", "EU"}

End Sub

I will be glad to hear if this works or not?

Cor
I try your codes, it doesn't work.
It only work for one datagrid in one windowform,
Now, mysolution is One Table, Two datasets, Two datagrids, one Dataset per
one datagrid.

"Cor Ligthert" <no************@planet.nl> ¦b¶l¥ó
news:uA**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
> Agnes,
>
> Normally that should work, when you use the right quotes.
>
> \\\
> dvF.rowfilter = "sex = 'F'"
> dvM.rowfilter = "sex = 'M'"
> dgF.datasource = dvF
> dgM.datasource = dvM
> ///
>
> That should work, and give a reply if when it does , I get the idea you> seldom do that.
>
> Cor
>
>



Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve Donnor | last post by:
Here's my question.. I have a Dataset which has populated a datagrid with information from an AS400 That SQL looks like this "Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS =...
0
by: Frosty | last post by:
Hi I am using the VS xsd designer to create a strongly typed dataset. The dataset is apparently successfully created, with no warnings or errors given. Is it not then to be expected that this...
3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
1
by: Krzysztof Karnicki | last post by:
I have such a problem… I have create my custom DataGridColumn inheriting from System.Windows.Forms.DataGridColumnStyle on using it on DataGrid, to show rows painted by me self. Because dates ...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
3
by: Ben Becker | last post by:
I am trying to build a custom crosstab type of grid where I take some items in a data grid and based on the content of the current item compared to the previous item, determine if a new row in a...
2
by: Bennett Haselton | last post by:
I know how to create a DataAdapter that loads data from a data source into a table in a typed DataSet, and how to set the DataSource and DataMember properties of a DataGrid so that at run time it...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.