Windows Form DataGridView Parent/Child View

This example demonstrates a Windows Forms equivalent to the Microsoft Access one-to-many form by binding a DataSet containing a DataRelation between 2 DataTables to a DataGridView resulting in Parent/Child views. This sample was built using Visual Studio 2010.

C# (215.0 KB)
 
 
 
 
 
4.7 Star
(6)
8,778 times
Add to favorites
2/22/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • This idea in multiple forms with a lot more records?
    2 Posts | Last post June 28, 2011
    • How I got here.
      
      I'm looking to connect to a SQL Server pull a single table into a dataset. 
      
      Through ONE Text box and ONE search button on my form I want to allow an end user to search for a subset of records from a table, bring up all records that contain either an ID or a Name in any of three feilds(userID, firstName, LastName).
      
      Upon locating the record, select that record by double clicking on it and have it load that single record into another form that is in form view not a data grid for editing/data entry.
      
      Could be that people finding this sample, aren't really getting what they were looking for.
    • MarcDeVegas,
      
      I provided this sample because there was a code sample request for the Windows Forms equivalent of the Microsoft Access Form/Subform.  This is clearly stated in the description.  Please see the code sample requests here:
      
      http://code.msdn.microsoft.com/site/requests
      
      Thank you,
      
      -Brandon
  • Scenario examples
    4 Posts | Last post June 03, 2011
    • Would you mind updating with example scenarios of how you have/could use this? 
      
      I'm not sure why this doesn't have higher ratings and views since it was requested by many (it would be good to see why people give samples like these low ratings... it could just be that they wouldn't use it). Thanks for creating this!
    • Also I appreciate that you include the code in the description. This should be done more.
    • Hi Ed,
      
      Thank you for the feedback.  I've been waiting for some.
      
      To be honest, I just saw it as a code sample request and fulfilled it.  As you probably know, this type of code example (data relations) is not uncommon.  I saw the request for the Windows Forms equivalent of the Microsoft Access one-to-many form and immediately thought of this solution.
      
      As far as scenarios that this can be used for, this will only be limited by the imagination.  But I use it when working with relational data in DataGridViews.
    • I will update with example scenarios.  Thank you Ed.