ComponentOne True DBGrid for WinForms
True DBGrid for WinForms Tutorials / Tutorial 16: Using the Hierarchical Display
In This Topic
    Tutorial 16: Using the Hierarchical Display
    In This Topic

    In this tutorial, you will learn how to display Master Detail DataSet information through the grid's hierarchical display. This tutorial is similar to Tutorial 3: Linking Multiple True DBGrid Controls, but this tutorial displays the same master detail information as Tutorial 3: Linking Multiple True DBGrid Controls, except it only uses one C1TrueDBGrid object.

    Complete the following steps:

    1. Start by setting up a form with a grid and Master Detail DataSet by following the steps in Tutorial 3: Linking Multiple True DBGrid Controls.
    2. In the Properties window, set the DataSource property of the grid to dsMasterDetail and the DataMember property to Composer.
    3. Next in the Load event of Form1 add the following code, which fills both the DataAdapters and sets the grid's display to hierarchical:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Me.ComposerTableAdapter.Fill(Me.DsMasterDetail.Composer)
      Me.OpusTableAdapter.Fill(this.DsMasterDetail.Opus)
      Me.C1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Hierarchical
      

      To write code in C#

      C#
      Copy Code
      this.ComposerTableAdapter.Fill(this.DsMasterDetail.Composer);
      this.OpusTableAdapter.Fill(this.DsMasterDetail.Opus);
      this.c1TrueDBGrid1.DataView = C1.Win.C1TrueDBGrid.DataViewEnum.Hierarchical;
      

    Run the program and observe the following:

    You've successfully completed using the hierarchical display; this concludes the tutorial.