'Declaration Public Property FormatProvider As IFormatProvider
public IFormatProvider FormatProvider {get; set;}
FormatProvider is used to convert between text and the value. The editor will use this along with Format property setting to convert the value to text for display purposes. Note that when editing, only the FormatProvider will be used and the Format property will be ignored. This is to facilitate easier editing of values without the clutter of formatting symbols.
The default behavior can be changed by providing custom conversion logic using ValueToTextConverter and ValueToDisplayTextConverter properties.
Note: FormatProvider property is of type IFormatProvider interface. IFormatProvider is implemented by CultureInfo object therefore this property can be set to an instance of CultureInfo. You can also use DateTimeFormatInfo or NumberFormatInfo as these implement the interface as well.
Protected Overrides Sub OnInitialized(ByVal e As EventArgs) MyBase.OnInitialized(e) Me.textEditor1.ValueType = GetType(Decimal) Me.textEditor1.Format = "C" Me.textEditor1.FormatProvider = New System.Globalization.CultureInfo("fr-FR") Me.textEditor1.Value = 10 Debug.WriteLine("Text = " & Me.textEditor1.DisplayText) End Sub
protected override void OnInitialized( EventArgs e ) { base.OnInitialized( e ); this.textEditor1.ValueType = typeof( Decimal ); this.textEditor1.Format = "C"; this.textEditor1.FormatProvider = new System.Globalization.CultureInfo( "fr-FR" ); this.textEditor1.Value = 10; Debug.WriteLine( "Text = " + this.textEditor1.DisplayText ); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2