Category / Section
How to set the data type of a column in a WinForms GridGroupingControl?
1 min read
Data type of a column
By default, the data tyle for each columns will be assigned directly from the Datasource. For example, if the DataTable is populated with the below data, the corresponding column will be integer column.
C#
DataColumn datacolumn; dc.DataType = typeof(int);
VB
Dim dc As DataxColumn dc.DataType = GetType(Integer)
But the data type for any column can be changed manually using CellValueType property.
C#
GridColumnDescriptor columndescriptor = new GridColumnDescriptor("Column_Name"); columndescriptor.Appearance.AnyCell.CellValueType = typeof(double);
VB
Dim desc As New GridColumnDescriptor("Id") desc.Appearance.AnyCell.CellValueType = GetType(Double)
Screenshot
Samples:
C#: DataType_CS
VB: DataType_VB