Infragistics(R) NetAdvantage(R) Windows Forms
Format Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridColumn Class : Format Property

Glossary Item Box

Returns or sets a string used to control the formatting of displayed text.

Syntax

Visual Basic (Declaration) 
Public Property Format As String
C# 
public string Format {get; set;}

Remarks

The Format property is similar to the Visual Basic Format function, and supports all of the named arguments and literal strings supported by that function when the UltraGrid is being used in Visual Basic. In other host environments, the Format property provides a subset of the Format function's capabilites, including the use of named arguments.

The Format property applies only to cells that are not in edit mode.

The underlying .NET formatting mechanism is used to format the value. See .NET help for more information regarding list of the named formats that are supported.

Example

Following code sets the Format and FormatInfo formatting properties on two columns.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button96_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button96.Click

      Dim dateColumn As UltraGridColumn = Me.UltraGrid1.DisplayLayout.Bands(1).Columns("OrderDate")
      Dim currencyColumn As UltraGridColumn = Me.UltraGrid1.DisplayLayout.Bands(2).Columns("Unit Price")

      ' Set the Format and FormatInfo properties. You don't have to set both. You can set one
      ' or the other or both.
      currencyColumn.Format = "##,###,####.00"
      currencyColumn.FormatInfo = System.Globalization.CultureInfo.CreateSpecificCulture("fr")

      dateColumn.Format = "dd/M/yyyy"
      dateColumn.FormatInfo = System.Globalization.CultureInfo.CreateSpecificCulture("fr")

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button96_Click(object sender, System.EventArgs e)
{

	UltraGridColumn dateColumn = this.ultraGrid1.DisplayLayout.Bands[1].Columns["OrderDate"];
	UltraGridColumn currencyColumn = this.ultraGrid1.DisplayLayout.Bands[2].Columns["Unit Price"];

	// Set the Format and FormatInfo properties. You don't have to set both. You can set one
	// or the other or both.
	currencyColumn.Format = "##,###,####.00";
	currencyColumn.FormatInfo = System.Globalization.CultureInfo.CreateSpecificCulture( "fr" );

	dateColumn.Format = "dd/M/yyyy";
	dateColumn.FormatInfo = System.Globalization.CultureInfo.CreateSpecificCulture( "fr" );

}

See Also