GrapeCity MultiRow Windows Forms Documentation
Text Formatting

Cell styles support text formats based on the .NET Framework. The text format can be set using the CellStyle.Format property and the CellStyle.FormatProvider property. You can use the Styles of the Cell Types to determine whether the cell type supports the text format of that style. For details about usable formats and the support of data types, refer to Formatting Types http://msdn.microsoft.com/en-us/library/fbxft59x.aspx.

Text Content Formatting

You can set the formatting to be applied when the text contents are displayed, by specifying the formatting string in the CellStyle.Format property.

Using Code

The following code shows the integer value in currency format using the present culture.

[VB]

Imports GrapeCity.Win.MultiRow

Dim textBoxCell As TextBoxCell = TryCast(gcMultiRow1.Rows(0).Cells(0), TextBoxCell)
textBoxCell.ReadOnly = True
textBoxCell.Value = 20000
textBoxCell.Style.Format = "c"

[CS]

using GrapeCity.Win.MultiRow;

TextBoxCell textBoxCell = gcMultiRow1.Rows[0].Cells[0] as TextBoxCell;
textBoxCell.ReadOnly = true;
textBoxCell.Value = 20000;
textBoxCell.Style.Format = "c";

Culture Specific Formatting

You can specify the culture to be applied to the formatting using the CellStyle.FormatProvider property.

Using Code

The following code displays the value in the US currency format.

[VB]

Imports GrapeCity.Win.MultiRow
Imports System.Globalization

Dim textBoxCell As TextBoxCell = TryCast(gcMultiRow1.Rows(0).Cells(0), TextBoxCell)
textBoxCell.ReadOnly = True
textBoxCell.Value = 20000
textBoxCell.Style.Format = "c"
textBoxCell.Style.FormatProvider = New CultureInfo("en-US")

[CS]

using GrapeCity.Win.MultiRow;
using System.Globalization;

TextBoxCell textBoxCell = gcMultiRow1.Rows[0].Cells[0] as TextBoxCell;
textBoxCell.ReadOnly = true;
textBoxCell.Value = 20000;
textBoxCell.Style.Format = "c";
textBoxCell.Style.FormatProvider = new CultureInfo("en-US");
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options