Syncfusion.Grid.Windows
Example 


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

PopulateHeaders Method (GridModel)

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

Parameters

range
The destination range.
dataSource
A data source that implements the IList interface or is an Array.
Example
This example shows how to populate the headers with the specified range and 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 headers
this.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, 0, 4), 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 headers
Me.gridControl1.PopulateHeaders(GridRangeInfo.Cells(0, 1, 0, 4), dataTable)
AssemblyVersion

Syncfusion.Grid.Windows: 17.3460.0.26

See Also