MultiRow Windows Forms > Developer's Guide > Using MultiRow > Cell Styles > 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.
You can set the formatting to be applied when the text contents are displayed, by specifying the formatting string in the CellStyle.Format property.
The following code shows the integer value in currency format using the present culture.
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" |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell = gcMultiRow1.Rows[0].Cells[0] as TextBoxCell; textBoxCell.ReadOnly = true; textBoxCell.Value = 20000; textBoxCell.Style.Format = "c"; |
You can specify the culture to be applied to the formatting using the CellStyle.FormatProvider property.
The following code displays the value in the US currency format.
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") |
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"); |