[]
        
(Showing Draft Content)

Binding Data to a Control

This walkthrough connects to a CSV file, creates a Data View, and binds it to a DataGridView control.

  1. Create a Windows Forms App project in C#.

  2. Open the form in the designer, add a DataGridView control, and save the form.

  3. Select View > ComponentOne Data Wizard to open the Data Wizard tool window.

  4. Click Add Connection.

  5. Select CSV in the Connector list, enter a Connection Name, and enter a path to a CSV file.

  6. If the first row contains column headers, select Contains Headers.

  7. Select ADO.NET(With DataTables).

  8. Click Test Connection, then click Add Connection.

  9. Hover over the connection in the tool window and click Add Data View.

  10. In the Query Builder, add a table from the Schema panel and select the required columns.

  11. Enter a Data View name and click Save Data View.

  12. Select the DataGridView control on the designer form.

  13. Expand the connection, hover over the Data View, and click Bind to control.

  14. Run the application. The DataGridView control displays the data from the Data View.

Important: Data Wizard writes the generated declarations and bindings to a .DataWizard.cs file in the project. Do not edit this file. Data Wizard recognizes only the code it writes.