Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Convert.ToDecimal Method (Char)

Calling this method always throws InvalidCastException.

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

'Declaration
Public Shared Function ToDecimal ( _
	value As Char _
) As Decimal

Parameters

value
Type: System.Char
A Unicode character.

Return Value

Type: System.Decimal
This conversion is not supported. No value is returned.

ExceptionCondition
InvalidCastException

This conversion is not supported.

This method is reserved for future use.

The following code sample attempts to convert a Char value to Decimal, throwing InvalidCastException upon failure.


Public Sub ConvertCharDecimal(ByVal charVal As Char)
   Dim decimalVal As [Decimal] = 0

   ' Char to decimal conversion is not supported and will always
   ' throw an InvalidCastException.
   Try
      decimalVal = System.Convert.ToDecimal(charVal)
   Catch exception As System.InvalidCastException
      outputBlock.Text &= String.Format( _
           "Char-to-decimal conversion is not supported " + _
           "by the framework.") & vbCrLf
   End Try

   'Decimal to char conversion is also not supported.
   Try
      charVal = System.Convert.ToChar(decimalVal)
   Catch exception As System.InvalidCastException
      outputBlock.Text &= String.Format( _
          "Decimal-to-char conversion is not supported " + _
          "by the framework.") & vbCrLf
   End Try
End Sub


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft