Methods

 

The NumericInputBox stores it’s Value as a typed ValueType.  However, neither VB.Net (with Option Strict On)  or C# will implicitly convert a ValueType to one of the strong types such as System.Double.  Therefore, the following ToType conversion methods are provided to perform the conversion.

Example:  NumericInputBox1.ToInt32()        [converts the value to a System.Int32]

Note:  Invalid conversions will throw an Invalid Cast Exception.

An example of an invalid cast would be if the Value was negative and you called ToUInt16 (unsigned 16 bit integer).

Public Method Name Description
ToByte() Type: System.Byte
ToDecimal() Type: System.Decimal
ToDouble() Type: System.Double
ToInt16() Type: System.Int16
ToInt32() Type: System.Int32
ToInt64() Type: System.Int64
ToSByte() Type: System.SByte
ToSingle() Type: System.Single
ToUint16() Type: System.UInt16
ToUInt32() Type: System.UInt32
ToUInt64() Type: System.UInt64

[Back to Documentation]

Last edited Feb 21, 2013 at 2:08 AM by TnTInMN, version 8

Comments

No comments yet.