How to Set Data Type of Column in WinForms GridGroupingControl?
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 in WinForms Grid.
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
Conclusion
I hope you enjoyed learning on how to set data type of a column in WinForms GridControl.
You can refer to WinForms Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Grid example to understand how to create and manipulate data.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!