Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DataGridView with Parent/Child relationship?

Posted on 2014-10-03
3
Medium Priority
?
1,520 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 64

Accepted Solution

by:
Fernando Soto earned 1000 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 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

722 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