Articles in this section
Category / Section

How to Set Data Type of Column in WinForms GridGroupingControl?

2 mins 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 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

change the data type to integer

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.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied