Converts a String to a Decimal.
[Visual Basic] Overloads Public Shared Function ToDecimal( _ ByVal value As String _ ) As Decimal [C#] public static Decimal ToDecimal( string value ); [C++] public: static Decimal ToDecimal( String* value ); [JScript] public static function ToDecimal( value : String ) : Decimal;
The Decimal with the value represented by value.
Exception Type | Condition |
---|---|
ArgumentException | value is null. |
FormatException | value does not contain a representation that can be converted to a Decimal using the Parse(String) method implemented by that type. |
OverflowException | value represents a number that is less than Decimal.MinValue or greater than Decimal.MaxValue. Note that if the beginning of the string value contains a properly formatted numerical value that will result in an overflow and, in addition, the end of the string is improperly formed, it cannot be determined whether an OverflowException or a FormatException will be thrown. This has been implemented this way for performance reasons. |
Implementation is the same as FromString. Note that if the beginning of the string value contains a properly formatted numerical value that will result in an overflow and, in addition, the end of the string is improperly formed, it cannot be determined whether an OverflowException or a FormatException will be thrown.
Convert Class | Convert Members | System Namespace | Convert.ToDecimal Overload List