GetCurrency Method for LCField

This method retrieves a Currency data type from a value in a field. If the requested data type is different from the field data type, conversion is automatically performed. If conversion is not possible, error LCFAIL_INVALID_CONVERT occurs.

Defined In

LCField

Syntax

Set newCurrency = lcField.GetCurrency (index)

Parameters

Parameter

Description

index

Long, >= 1. Index of the field data value to be retrieved.

Return Value

Value

Description

newCurrency

LCCurrency. The value of the retrieved data type.

Example

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

Example Output

The Currency representation of the field is 1234.5678.