We introduced the CSV DataConnector Data Service API with the 2022v3 version of ComponentOne, which supports CRUD operations over CSV files using ADO.NET or Entity Framework Core. We can connect to CSV data via Visual Studio Server Explorer and create queries using SQL or the query builder to retrieve the required data.
This blog will demonstrate how to connect to CSV data and display it on the form without writing a single line of code, using only the designer.
Ready to Test it Out? Download ComponentOne Today!
To display the CSV table data, we are using our flagship grid control, "FlexGrid." Therefore, in Visual Studio 2022, create a new Windows Form App project and drag the FlexGrid component from the toolbox into the Form Designer.
In the next step, we will create a connection with the CSV data source using Visual Studio’s Server Explorer Window. To see all the C1DataConnectors service components in the Server Explorer window, first, we need to install the latest version of Data Service using the ComponentOneControlPanel, as suggested here.
The following steps are required to establish a connection with CSV data:
Now that we have established a successful connection with our CSV Data Source, we will create a DataSet using the connected CSV Data Source and bind it to our FlexGrid. The steps are as follows:
Since we now have our dataset ready with the data table, the final step is to bind it to the FlexGrid by following the steps below:
When we launch the application, the resulting grid will look as shown in the GIF below.
Download the latest version of ComponentOne today and try the above-given steps to bind a data grid with data from a CSV data source using the C1CSV Data Connector’s Visual Studio integration.
Contact our support team on the Support portal if you face any issues while using any of the C1 controls and components.