The destination range.
A data source that implements the IList interface or is an Array.

PopulateValues Method (GridModel)

Gives you an easy way to copy data from any given datasource that implements the IList interface or is an Array to a specified range of cells in the grid.
Public Sub PopulateValues( _
   ByVal range As GridRangeInfo, _
   ByVal dataSource As Object _
Dim instance As GridModel
Dim range As GridRangeInfo
Dim dataSource As Object
instance.PopulateValues(range, dataSource)
public void PopulateValues( 
   GridRangeInfo range,
   object dataSource


The destination range.
A data source that implements the IList interface or is an Array.
PopulateValues uses the low-level SetCellInfo(Int32,Int32,GridStyleInfo,StyleModifyType) method to populate date from the given data source. This makes it a much faster way to fill grid cells instead of using Item or ChangeCells(GridRangeInfo,GridStyleInfo[],StyleModifyType). It will not generate undo information.

The grid display will be refreshed after the method finishes.

If you want to fill the grid with large amount of data and give the user a chance to abort the operation, you should assign a Syncfusion.Windows.Forms.DelayedStatusDialog to the model's OperationFeedbackListener.

This example shows how to populate the grid with values for a specified range from the data source.
// Populating DataSource
DataTable dataTable = new DataTable("Sample");
dataTable.Columns.Add("Column 1");
dataTable.Columns.Add("Column 2");
dataTable.Columns.Add("Column 3");
dataTable.Columns.Add("Column 4");
dataTable.Rows.Add("Row1", "Row2", "Row3", "Row4");
//Populating the values to grid
this.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, dataTable.Rows.Count, dataTable.Columns.Count), dataTable);
' Populating DataSource
Dim dataTable As New DataTable("Sample")
dataTable.Columns.Add("Column 1")
dataTable.Columns.Add("Column 2")
dataTable.Columns.Add("Column 3")
dataTable.Columns.Add("Column 4")
dataTable.Rows.Add("Row1", "Row2", "Row3", "Row4")
'Populating the values to grid
Me.gridControl1.PopulateValues(GridRangeInfo.Cells(1, 1, dataTable.Rows.Count, dataTable.Columns.Count), dataTable)

Syncfusion.Grid.Windows: 17.1460.0.47

See Also