このメソッドは、フィールドの値から Currency データ型を取り出します。要求されたデータ型がフィールドのデータ型と異なる場合は、自動的に変換を実行します。変換を実行できない場合は、LCFAIL_INVALID_CONVERT エラーが発生します。
LCField
Set newCurrency = lcField.GetCurrency (index)
パラメータ |
説明 |
---|---|
index |
Long、>= 1。取り出すフィールドのデータ値のインデックス。 |
値 |
説明 |
---|---|
newCurrency |
LCCurrency。取り出されたデータ型の値です。 |
Option Public
Uselsx "*lsxlc"
Sub Initialize
On Error LCFAIL_INVALID_CONVERT Goto InvalidCurrency
Dim Fld As New LCField (LCTYPE_TEXT)
Fld.Text = "1234.56789"
Dim vCurr As LCCurrency
Set vCurr = Fld.GetCurrency (1)
Print "The Currency representation of the field is " & vCurr.Text
Exit Sub
InvalidCurrency:
Print "Cannot convert " & Fld.Text & " to type Currency."
Exit Sub
End Sub
The Currency representation of the field is 1234.5678.