$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Data Grid WinForms Control
Create data gird view in C# with modern user interface for your Windows Forms applications
Home > WinForms UI Controls > User Manual > Data Formatting in C#

C# Data Formatting for Grid Control

The DataGrid Controls for Windows Forms applications are an amazing component for design modern user interface. This cool control provides large flexibility to meet any critical requirements of applications nowadays. Furthermore, the DataGrid View control also provides data presentation, data refresh, data entry, data analysis, codeless development and hardcore coding functionalities. The following is a C# tutorial that shows how to create gird in Windows Forms project to present tables.

Formatting Data in C#

The following are the demonstration of formatting data for Data Grid control and display them. To format data, we need to use the properties of column, FormatString, FormatInfo and NullValue.
  • FormatString, this property is used to format the values in cells to strings.
  • FormatCultureInfo, this property is used to apply string formatting to the specified culture
  • NullValue, this property is able to control the value that will be displayed whether the cell value is null.

GridDecimalColumn productNameColumn = this.ketticGrid.Columns["ProductWeight"] as GridDecimalColumn;
productWeightColumn.FormatString = "Weight: {0:C}";
productWeightColumn.FormatInfo = CultureInfo.CreateSpecificCulture("fr-GB");
productWeightColumn.NullValue = 0;
  • WrapText, this property is able to wrap text if the text is longer than the maximum width of the column and break a single text line into two or more
  • TextAlignment, this property is used to align the text of the column in the Grid control.

GridwDataColumn productNameColumn = this.ketticGrid.Columns["ProductDescription"];
productDescriptionColumn.WrapText = true;
productDescriptionColumn.TextAlignment = ContentAlignment.BottomLeft;
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls