Solved

DataGridView with Parent/Child relationship?

Posted on 2014-10-03
3
1,291 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 250 total points
ID: 40359563
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
ID: 40363821
Here is an alternative using a TreeView

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

Author Comment

by:BlakeMcKenna
ID: 40363914
CodeCruiser,

Thank you for the link.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sql server insert 13 46
Help with exporting to excel 4 44
Import MySQL data into MS Access using VB.Net interface 5 47
VB.Net Data Class 1 16
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

735 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