Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 DigitSubstitution Property
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
NumberFormatInfo..::.DigitSubstitution Property

Updated: November 2007

Gets or sets a value that specifies how the graphical user interface displays the shape of a digit.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Visual Basic (Declaration)
<ComVisibleAttribute(False)> _
Public Property DigitSubstitution As DigitShapes
Visual Basic (Usage)
Dim instance As NumberFormatInfo
Dim value As DigitShapes

value = instance.DigitSubstitution

instance.DigitSubstitution = value
C#
[ComVisibleAttribute(false)]
public DigitShapes DigitSubstitution { get; set; }
Visual C++
[ComVisibleAttribute(false)]
public:
property DigitShapes DigitSubstitution {
    DigitShapes get ();
    void set (DigitShapes value);
}
J#
/** @property */
/** @attribute ComVisibleAttribute(false) */
public DigitShapes get_DigitSubstitution()
/** @property */
/** @attribute ComVisibleAttribute(false) */
public  void set_DigitSubstitution(DigitShapes value)
JScript
public function get DigitSubstitution () : DigitShapes
public function set DigitSubstitution (value : DigitShapes)

Property Value

Type: System.Globalization..::.DigitShapes

One of the DigitShapes values.

ExceptionCondition
InvalidOperationException

The current NumberFormatInfo object is read-only.

ArgumentException

The value in a set operation is not a defined DigitShapes value.

The following code example demonstrates the DigitSubstitution property.

Visual Basic
' This example demonstrates the System.Global-
' ization.NumberFormatInfo.DigitSubstitution property.

Imports System
Imports System.Globalization

Class Sample
    Public Shared Sub Main() 
        Dim westernCI As New CultureInfo("en-US")
        Dim arabicCI As New CultureInfo("ar-SA")
        Dim thaiCI As New CultureInfo("th-TH")
        Dim shape As DigitShapes
        Dim name As String
        Dim intro As String = "The digit substitution value for the {0} culture is {1}."

        ' Western culture.
        name = westernCI.EnglishName
        shape = westernCI.NumberFormat.DigitSubstitution
        Console.WriteLine(intro, name, shape)

        ' Arabic culture.
        name = arabicCI.EnglishName
        shape = arabicCI.NumberFormat.DigitSubstitution
        Console.WriteLine(intro, name, shape)

        ' Thai culture.
        name = thaiCI.EnglishName
        shape = thaiCI.NumberFormat.DigitSubstitution
        Console.WriteLine(intro, name, shape)

    End Sub 'Main
End Class 'Sample

'
'This code example produces the following results:
'
'The digit substitution value for the English (United States) culture is None.
'The digit substitution value for the Arabic (Saudi Arabia) culture is Context.
'The digit substitution value for the Thai (Thailand) culture is None.
'

C#
// This example demonstrates the System.Global-
// ization.NumberFormatInfo.DigitSubstitution property.

using System;
using System.Globalization;

class Sample 
{
    public static void Main() 
    {
    CultureInfo westernCI = new CultureInfo("en-US");
    CultureInfo arabicCI  = new CultureInfo("ar-SA");
    CultureInfo thaiCI    = new CultureInfo("th-TH");
    DigitShapes shape;
    string name;
    string intro = "The digit substitution value for the {0} culture is {1}.";

// Western culture.
    name  = westernCI.EnglishName;
    shape = westernCI.NumberFormat.DigitSubstitution;
    Console.WriteLine(intro, name, shape);

// Arabic culture.
    name  = arabicCI.EnglishName;
    shape = arabicCI.NumberFormat.DigitSubstitution;
    Console.WriteLine(intro, name, shape);

// Thai culture.
    name  = thaiCI.EnglishName;
    shape = thaiCI.NumberFormat.DigitSubstitution;
    Console.WriteLine(intro, name, shape);
    }
}

/*
This code example produces the following results:

The digit substitution value for the English (United States) culture is None.
The digit substitution value for the Arabic (Saudi Arabia) culture is Context.
The digit substitution value for the Thai (Thailand) culture is None.

*/

Visual C++
// This example demonstrates the
// System.Globalization.NumberFormatInfo.DigitSubstitution property.

using namespace System;
using namespace System::Globalization;

int main()
{
    CultureInfo^ westernCI = gcnew CultureInfo("en-US");
    CultureInfo^ arabicCI  = gcnew CultureInfo("ar-SA");
    CultureInfo^ thaiCI    = gcnew CultureInfo("th-TH");
    DigitShapes shape;
    String^ name;
    String^ intro = "The digit substitution value for " +
        "the {0} culture is {1}.";

    // Western culture.
    name  = westernCI->EnglishName;
    shape = westernCI->NumberFormat->DigitSubstitution;
    Console::WriteLine(intro, name, shape);

    // Arabic culture.
    name  = arabicCI->EnglishName;
    shape = arabicCI->NumberFormat->DigitSubstitution;
    Console::WriteLine(intro, name, shape);

    // Thai culture.
    name  = thaiCI->EnglishName;
    shape = thaiCI->NumberFormat->DigitSubstitution;
    Console::WriteLine(intro, name, shape);
}

/*
This code example produces the following results:

The digit substitution value for the English (United States) culture is None.
The digit substitution value for the Arabic (Saudi Arabia) culture is Context.
The digit substitution value for the Thai (Thailand) culture is None.

*/

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker