473,769 Members | 7,013 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Containment hierarchy in master-detail grids

This post is for the Google crawler-- no response in required.

Can a containment hierarchy made up of two collections derived from
BindingList<T> be data-bound to master-detail dataGridView controls?

Assume a collection, CustomerList, derived from BindingList<T>, with a
property Orders, of type OrderList, also derived from BindingList<T>. Here
is how to create a master-detail pair of grids:

In design mode, create a form with two dataGridView controls, dgvCustomers
and dgvOrders. Add two BindingSource components, bsCustomers, and bsOrders.
Set the DataSource for dgvCustomers to bsCustomers, and set the DataSource
for bsCustomers to the CustomerList object. Set the DataSource for DGVOrders
to bsOrders. Now, here's the trick--set the DataSource for bsOrders to
bsCustomers. Drop down the list for bsOrders' DataMember property, and you
will see "Orders". Select that, and dgvOrders will show the OrderList
properties as columns.

At this point, both grids can be configured and formatted as desired. But
all we've really done is bound the grids to our objects' schema--we still
need to wire up the run time customer list. One line of code will do it.
Assume the CustomerList is contained in a member variable variable
m_Customers:

bsCustomers.Dat aSource = m_Customers;

Now the two grids will behave as a master-detail pair. As different
customers are selected in dgvCustomers, dgvOrders will update to show those
customers' orders.

Jan 4 '06 #1
0 1890

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

Similar topics

2
4515
by: Chandrashekara Adiga | last post by:
hi This is particular to Containment classes .. ( just taking an example from rougewave ) Can someone point out How destrutor of new RWDate(2, "Nov", 1980) will be called? Is is our responsibilty to call it or such container after deleting the list element calls the destuctor also .
1
3930
by: Dave | last post by:
Hello all, The methodology of policy-based design states that one should inherit from policy classes and, of course, these classes must provide an agreed-upon public interface and semantics. I would like to understand better why inheritance, rather than containment, is espoused. The only things I can see that inheritance provides beyond containment is the possibility of polymorphism and access to protected members. Since neither of...
2
4722
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: http://biz2tek.com/tmp/overall-class-hierarchy-sde (This link may be temporary; email me if you can't get access to it, I
1
3250
by: Baski | last post by:
Does anyone knows any article explains effective use of containment and aggregation with interfaces using C#. Thanks Baski
7
2379
by: SpookyET | last post by:
/FooProject /bin (release) /doc /src (only *.cs) /temp (obj files) /test (debug) /build /Visual Studio 2003 /Visual Studio 2005
3
1350
by: Mr Dyl | last post by:
Hello, maybe somebody can enlighten me? :) I wasn't really sure how to concisely describe the following scenario so it was tricky to search for help. Simplifying the problem... I have a home which contains people. I also want a SpecialHome which has to contain a set of SpecialPersons.
2
4755
by: Luke Dalessandro | last post by:
I have an application with the following layout /root/ /root/Default.aspx /root/web.config /root/child/ /root/child/web.config web.config has a custom configuration section "testSection" with the
3
3332
by: krzysztof.konopko | last post by:
Hello! I want to design a class hierarchy with one base abstract class, let's say CBase. I have a predicate that every object in the class hierarchy must have a parent object of type from this class hierarchy but only objects of some of these types can be a parent. Example: class CFruit : public CBase { }; class CBranch : public CBase { };
12
5470
by: Daz | last post by:
Hi guys, I'm trying to make a script.aculo.us sortable list have a limited number of elements in it. Now I can check for this really easily and have a warning message, and of course the php throws an error back anyway so they can't actually save more than the limit, but, is there a way I can stop them from dropping the damn thing in the list if it's full? I thought about dynamically setting the containment array, so that
2
1336
by: Tem | last post by:
I have a table that looks like this. Each row is a reply or a topic when IsAReplyTo = 0 I need to write a query that pulls all rows of a hierarchy of a given ID Table Forum ID IsAReplyTo 4 0 9 4 27 4 63 27
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9414
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10197
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9848
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8860
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7391
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3549
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.