Convert.ToString Method (Decimal)
.NET Framework (current version)
Converts the value of the specified decimal number to its equivalent string representation.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
-
Type:
System.Decimal
The decimal number to convert.
This implementation is identical to Decimal.ToString().
The following example converts a Decimal to a String.
Public Sub ConvertStringDecimal(ByVal stringVal As String) Dim decimalVal As Decimal = 0 Try decimalVal = System.Convert.ToDecimal(stringVal) System.Console.WriteLine("The string as a decimal is {0}.", _ decimalVal) Catch exception As System.OverflowException System.Console.WriteLine( _ "Overflow in string-to-decimal conversion.") Catch exception As System.FormatException System.Console.WriteLine( _ "The string is not formatted as a decimal.") Catch exception As System.ArgumentException System.Console.WriteLine("The string is null.") End Try ' Decimal to string conversion will not overflow. stringVal = System.Convert.ToString(decimalVal) System.Console.WriteLine("The decimal as a string is {0}.", _ stringVal) End Sub
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: