Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added FormattedDoubleTextBox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# How to format the doubletextbox cell in winforms gridcontrol
This example demonstrates how to format the doubletextbox cell in winforms gridcontrol
# How to Format the DoubleTextbox Cell in WinForms GridControl?

This example demonstrates how to format the doubletextbox cell in [WinForms GridControl](https://www.syncfusion.com/winforms-ui-controls/grid-control).

By default, the value "0" will be displayed as "0.00" in the [DoubleTextBox](https://help.syncfusion.com/windowsforms/grid-control/enhanced-cell-types#doubletextbox-cell-type) cell. To customize the display format of cell value, use the [DisplayText](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Grid.GridDrawCellDisplayTextEventArgs.html#Syncfusion_Windows_Forms_Grid_GridDrawCellDisplayTextEventArgs_DisplayText) property in [DrawCellDisplayText](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.Grid.GridControlBase.html#Syncfusion_Windows_Forms_Grid_GridControlBase_DrawCellDisplayText) event.

``` c#
//Event Subscription
gridControl1.DrawCellDisplayText += GridControl1_DrawCellDisplayText;

//Event Customization
private void GridControl1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
if(e.Style.CellType== CustomCellTypes.DoubleTextBox.ToString() && e.DisplayText== "0.00")
{
e.DisplayText = "0";
}
}
```

The screenshot below illustrates the format of grid cells.

![GridControl with formatted DoubleTextbox](FormattedDoubleTextBox.png)