473,385 Members | 1,309 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,385 software developers and data experts.

parent child grandchild grids

Hi,

I wondering if someone can explain the best way to show three datagrids
in a parent/child/grandchild relationship?

For example:
Take a simple form with 3 datagrids - the top for the customers, the
middle for the orders, and the bottom for the items of the order.

I'd like to know the best why to update the grids so that when the user
changes the current row in the customers' grid, only that customer's
orders are displayed in the middle orders grid. At the same time, I'd
like the bottom items' grid to display only the rows belonging to the
currently selected order in the middle grid.

I've been doing this for years in other languages (mostly DOS based
xBase languages) but I am new to doing this in VB.

Can anyone get me started?

Richard
Nov 21 '05 #1
4 1625
Richard,

There is no best way.

I myself go mostly for the situation when it are comboboxes to create
dependable dataviews.

This I did not with a datagrid however it should be possible when you use
the currencymanager (I never did it this way)

Datagrid 1 is a full datagrid of all

Datagrid 2 is a datagrid, that has a dataview with rowfilter depending on a
column on the current position of datagrid1 (you need the currencymanager
for that, that is not about money what a lot of people think at the start)

http://msdn.microsoft.com/library/de...classtopic.asp

Datagrid 3 is a datagrid, that has the same based on Datagrid2

It needs to much code (sample datatables) to make a simple sample for this.

You can however as well go for the datarelation way.

http://msdn.microsoft.com/library/de...tionstopic.asp

As I said before I never did this kind of things with 3 deep except with the
combobox and than I have again another approach.

I hope thst this gives some ideas.

Cor
Nov 21 '05 #2
Hi Cor,

I have started experimenting with the CurrencyManager and the DataView
and they seem to be exactly what I need.

My question is where should I declare them?

I would like to be able to access Dataviews and rowfilters from an event
and I don't know who to give them proper scope.

I tried to declare them at the top of the form but I was having trouble
with the data adapters.

Where is the best place to declare the following (top of form, code
module, form load event?)
- sqlconnections
- data adapters
- data sets
- relations
- dataviews

You have definitely given me many ideas to try out, thanks!

Richard

Cor Ligthert wrote:
Richard,

There is no best way.

I myself go mostly for the situation when it are comboboxes to create
dependable dataviews.

This I did not with a datagrid however it should be possible when you use
the currencymanager (I never did it this way)

Datagrid 1 is a full datagrid of all

Datagrid 2 is a datagrid, that has a dataview with rowfilter depending on a
column on the current position of datagrid1 (you need the currencymanager
for that, that is not about money what a lot of people think at the start)

http://msdn.microsoft.com/library/de...classtopic.asp

Datagrid 3 is a datagrid, that has the same based on Datagrid2

It needs to much code (sample datatables) to make a simple sample for this.

You can however as well go for the datarelation way.

http://msdn.microsoft.com/library/de...tionstopic.asp

As I said before I never did this kind of things with 3 deep except with the
combobox and than I have again another approach.

I hope thst this gives some ideas.

Cor

Nov 21 '05 #3
Richard,

I would not worry to much at this moment about what you ask now.

datagrid1.datasource = dataview1

than
directcast(datagrid1.datasource,dataview).table (gives you your original
table
than
directcast(datagrid1.datasource,dataview) gives you your used dataview
(depend of you instanced it with new, otherwise is that the
datatable.defaultview

However don't worry first try to understand those other things in my opinion
and make your program running. Optimizing comes when you understand what you
are doing.

The rule is that when you can declare/instance something as low as possible
in a method you would have to do that. (Gives beside better reading a better
performance of the GC).

What gives:
(Load event) is as every method
Top of form is global for the class
Module is global for your application.

As exacmple
Not
Dim i as integer,
for i = 0 to end
however
for i as integer = 0 to end

And only when this is not possible than every time a level higher (by
instance in this sample when you exit the for loop and need that "i" because
that was the last one)

I hope this helps,

Cor
Nov 21 '05 #4
Hi Cor,

Thanks for your help. I almost got it the way I want. I need to do
more testing.
Richard

p.s. thanks for the idea about directcast, I never even heard of that
command :)

Cor Ligthert wrote:
Richard,

I would not worry to much at this moment about what you ask now.

datagrid1.datasource = dataview1

than
directcast(datagrid1.datasource,dataview).table (gives you your original
table
than
directcast(datagrid1.datasource,dataview) gives you your used dataview
(depend of you instanced it with new, otherwise is that the
datatable.defaultview

However don't worry first try to understand those other things in my opinion
and make your program running. Optimizing comes when you understand what you
are doing.

The rule is that when you can declare/instance something as low as possible
in a method you would have to do that. (Gives beside better reading a better
performance of the GC).

What gives:
(Load event) is as every method
Top of form is global for the class
Module is global for your application.

As exacmple
Not
Dim i as integer,
for i = 0 to end
however
for i as integer = 0 to end

And only when this is not possible than every time a level higher (by
instance in this sample when you exit the for loop and need that "i" because
that was the last one)

I hope this helps,

Cor

Nov 21 '05 #5

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

Similar topics

0
by: Chris Waldmann via .NET 247 | last post by:
Here's the deal. I have a Typed Dataset. For simplicity, we'll say it has 2 tables Parent and Child with a FK in Child, relationname = FK, cascade on update. Kyes are negative autoincrement. I...
1
by: Samy | last post by:
Hi There, I have a child window opened from aspx page using window.open. On the child window, I have a button(New category) which opens a grandchild. I also have a cancel button on the child...
2
by: Sidorf | last post by:
Hi It's a little hard for me to explain my problem, but i'll try. I have an application in which i have a ManagerClass, many ClientClass-es ans some ControlClass. The ManagerClass creates one...
1
by: Roy | last post by:
How is it done? BTW, I'm reposting this here, as the datagrid newsgroup appears functionally comatose... I have a nested datagrid setup. When one updates the child grid using edit, it also...
0
by: I am Sam | last post by:
Can someone help me with a datarelations question? I set up a nested Repeater control using nested tables in a Sql Server database but I don't know how to set the datarelation between the child...
1
by: Jan Lorenz | last post by:
Hello, my problem is to show a datarelation between two tables (parent/child) in a datagridview. It doesn't works. There is always shown only 1 table in the grid (in relation of...
3
by: Irocivan | last post by:
Hello, I download a nice collapse menu for free distribution from the internet. It works very well except that none of the parents nodes are clickable (i.e. when clicking on the parent node, the...
0
by: dentyne | last post by:
Good morning, I have a typed dataset with 10 relational, hierarchical tables. I want to be able to "filter" all the dataset tables based on one parent record. For instance, let's say I have a...
8
by: Rick | last post by:
VS 2005 I' m setting up a parent/child datagridviews in a form. I am doing a lot of this by hand coding in order to get the feel of things. I want a change in the parent table to trigger a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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 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.