QuickStart

This quick start guide will walk you through the steps of creating a True DBGrid for WinForms application, binding the grid to a data source, and customizing the grid's appearance and behavior settings. You'll discover that you can easily create powerful database applications using True DBGrid for WinForms.

The quick start uses an Access database, C1NWind.mdb. The C1NWind.mdb database file is located in the Common subdirectory of the WinForms Edition program, the Documents\ComponentOne Samples\Common directory.

To create a simple WinForms application in .NET for True DBGrid control, complete the following steps:
  1. Create a new Windows Forms application.

  2. Add reference to C1.Win.TrueDBGrid NuGet package. Drag and drop the TrueDBGrid control from Toolbox to the form. Click 'Dock in Parent Container' option from the C1TrueDBGrid tasks menu.

  3. Create a sample datasource class 'DataSource'.

  4. Bind the True DBGrid to this datasource using the DataSource property of the C1.Win.TrueDBGrid.BaseGrid.Frame class. This will populate the True DBGrid control with data.

    C#
    Copy Code
    //bind to data source
    var data = C1.DemoData.DataSource.GetRows("Select * from Data");
    c1TruedbGrid1.DataSource = data;
    
  5. You can also customize the grid using the Caption, AllowAddNewAlternatingRows and EvenRowStyle properties.

    C#
    Copy Code
    //customize TrueDbGrid
    c1TruedbGrid1.Caption = "Data";
    c1TruedbGrid1.AllowAddNew = true;
    
    c1TruedbGrid1.AlternatingRows = true;
    c1TruedbGrid1.EvenRowStyle.BackColor = Color.LightBlue;
    

    Run the code and observe the output:

Note: WinForms .NET6 Edition does not include rich design-time support yet. We will enhance it in future releases.