DataGridTextBoxColumn::FormatInfo Property
Gets or sets the culture specific information used to determine how values are formatted.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public: [BrowsableAttribute(false)] property IFormatProvider^ FormatInfo { IFormatProvider^ get(); void set(IFormatProvider^ value); }
Property Value
Type: System::IFormatProvider^An object that implements the IFormatProvider interface, such as the CultureInfo class.
When setting the Format property to one of the formatting characters, the DataGridTextBoxColumn uses the information provided by the FormatInfo property to further specify what cultural-specific formatting to use. For example, when the Format property is set to the format character "c" (for currency), you can further specify that the symbol for the lira be used. To do this, create a new CultureInfo object with the locale ID for Italy, and set the FormatInfo property to the new CultureInfo object.
For more information about formatting characters, see Formatting Types in the .NET Framework and Custom Date and Time Format Strings.
The following example creates a new CultureInfo object and assigns it to the FormatInfo property of a DataGridTextBoxColumn object. The example also sets the Format property to "c" to specify that the column should display values as currency.
private: void ChangeColumnCultureInfo() { /* Create a new CultureInfo Object* using the the locale ID for Italy. */ System::Globalization::CultureInfo^ ItalyCultureInfo = gcnew CultureInfo( 0x0410 ); /* Cast a column that holds numeric values to the DataGridTextBoxColumn type, and set the FormatInfo property to the new CultureInfo Object*. */ DataGridTextBoxColumn^ myGridTextBoxColumn = dynamic_cast<DataGridTextBoxColumn^>(myDataGrid->TableStyles[ "Orders" ]-> GridColumnStyles[ "OrderAmount" ]); myGridTextBoxColumn->FormatInfo = ItalyCultureInfo; myGridTextBoxColumn->Format = "c"; }
Available since 1.1