Category / Section
How to populate a database in WinForms GridControl?
1 min read
Populate a database
The GridControl doesn’t have support to bind the DataSource directly. So, you can use the PopulateValues method to populate the data source and also populate the header using the PopulateHeaders method in GridControl.
C#
this.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, gridControl1.RowCount, gridControl1.ColCount), CreateTable()); this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), CreateTable());
VB
Me.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, gridControl1.RowCount, gridControl1.ColCount), CreateTable()) Me.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, gridControl1.RowCount, gridControl1.ColCount), CreateTable())
Figure 1: Output
Note:
Edited values are not committed with data source here because you can populate only the data values in GridControl.
Reference link: https://help.syncfusion.com/windowsforms/grid-control/populating-data