Solved

DataGridView with Parent/Child relationship?

Posted on 2014-10-03
3
1,069 Views
Last Modified: 2014-10-11
Is it possible to have a single DataGridView that contains a row with a master record and then contains multiple child records that can be expanded underneath the parent row? If a parent contains no child records, it displays normally, however, if a parent has child records, then place the "+" sign in the DGV RowHeader or somewhere at the beginning of the row to signify child records exist?

Thanks!
0
Comment
Question by:BlakeMcKenna
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 250 total points
Comment Utility
Hi  BlakeMcKenna;

The DataGridView control found in the Toolbox does not support that type of Master/Detail display option. To do what you would like you will need to use the older control called DataGrid control. You will need to add this control to the Toolbox before it can be used. Microsoft has replaced it with the newer control the DataGridView bit it does not do everything the older control did. To add the DataGrid to the Toolbox you can do the following.

1. In the Toolbox right click on the Tab you wish to place the control in such as the Data tab.
2. Click on the item "Choose Items..."
3. In the new window in the .Net Framework Components find the control DataGrid. Be careful there is also a DataGrid for Web apps. Select the one for Forms.
4. Click on the OK button.

The control is now in the Tab you placed it in and can be dragged onto the design surface.

The Following link will show you how to set it up
Creating Master-Details Lists with the Windows Forms DataGrid Control
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
Comment Utility
Here is an alternative using a TreeView

http://www.codeproject.com/Articles/23746/TreeView-with-Columns
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
CodeCruiser,

Thank you for the link.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now