我正在将一个应用程序从VB6迁移到VB.Net,其中使用Currency ClassStructure.我的问题是:VB6的 "等价物 "是什么?币种 在以下代码中?
Public Function getTimeElapsed() As Double
Dim cuStart As Currency
Dim cuStop As Currency
Dim cuFreq As Currency
Dim v As Double
Dim ReturnValue As Double
QueryPerformanceFrequency(liFrequency)
cuStart = LargeIntToCurrency(liStart)
cuStop = LargeIntToCurrency(liStop)
cuFreq = LargeIntToCurrency(liFrequency)
' elapsed time
v = CDbl(cuStop - cuStart) / CDbl(cuFreq)
Select Case ResultUnit
Case CounterUnit.Second
ReturnValue = v
Case CounterUnit.Millisecond
ReturnValue = v * 1000.0#
Case CounterUnit.microsecond
ReturnValue = v * 1000000.0#
Case CounterUnit.nanosecond
ReturnValue = v * 1000000000.0#
End Select
Return ReturnValue
End Function
Private Function LargeIntToCurrency(liInput As LARGE_INTEGER) As Currency
CopyMemory(LargeIntToCurrency, liInput, Strings.Len(liInput))
LargeIntToCurrency = LargeIntToCurrency * 10000
End Function
'货币' 在VB.Net中给出这样的错误。是否有什么缺失的库,必须要有?
代表货币的数据应该存储为 Decimal
在VB.NET中,它的值不容易发生四舍五入的错误。它不容易出现四舍五入的错误,就像 Double
是。