当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET Decimal.FromOACurrency方法代码示例

本文整理汇总了VB.NET中System.Decimal.FromOACurrency方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Decimal.FromOACurrency方法的具体用法?VB.NET Decimal.FromOACurrency怎么用?VB.NET Decimal.FromOACurrency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Decimal的用法示例。


在下文中一共展示了Decimal.FromOACurrency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: DecimalFromOACurrencyDemo

' Example of the Decimal.FromOACurrency method. 
Module DecimalFromOACurrencyDemo
    
    Const dataFmt As String = "{0,21}{1,25}"

    ' Display the Decimal.FromOACurrency parameter and Decimal result.
    Sub ShowDecimalFromOACurrency( Argument As Long )

        Dim decCurrency As Decimal = _
            Decimal.FromOACurrency( Argument )

        Console.WriteLine( dataFmt, Argument, decCurrency )
    End Sub

    Sub Main( )
        Console.WriteLine( "This example of the " & _
            "Decimal.FromOACurrency( ) method generates " & vbCrLf & _
            "the following output. It displays the OLE Automation " & _
            "Currency " & vbCrLf & "value as a Long and the " & _
            "result as a Decimal." & vbCrLf )
        Console.WriteLine( dataFmt, "OA Currency", "Decimal Value" )
        Console.WriteLine( dataFmt, "-----------", "-------------" )

        ' Convert OLE Automation Currency values to Decimal objects.
        ShowDecimalFromOACurrency( 0L )
        ShowDecimalFromOACurrency( 1L )
        ShowDecimalFromOACurrency( 100000L )
        ShowDecimalFromOACurrency( 100000000000L )
        ShowDecimalFromOACurrency( 1000000000000000000L )
        ShowDecimalFromOACurrency( 1000000000000000001L )
        ShowDecimalFromOACurrency( Long.MaxValue )
        ShowDecimalFromOACurrency( Long.MinValue )
        ShowDecimalFromOACurrency( 123456789L )
        ShowDecimalFromOACurrency( 1234567890000L )
        ShowDecimalFromOACurrency( 1234567890987654321 )
        ShowDecimalFromOACurrency( 4294967295L ) 
    End Sub
End Module 

' This example of the Decimal.FromOACurrency( ) method generates
' the following output. It displays the OLE Automation Currency
' value as a Long and the result as a Decimal.
' 
'           OA Currency            Decimal Value
'           -----------            -------------
'                     0                        0
'                     1                   0.0001
'                100000                       10
'          100000000000                 10000000
'   1000000000000000000          100000000000000
'   1000000000000000001     100000000000000.0001
'   9223372036854775807     922337203685477.5807
'  -9223372036854775808    -922337203685477.5808
'             123456789               12345.6789
'         1234567890000                123456789
'   1234567890987654321     123456789098765.4321
'            4294967295              429496.7295
开发者ID:VB.NET开发者,项目名称:System,代码行数:57,代码来源:Decimal.FromOACurrency


注:本文中的System.Decimal.FromOACurrency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。