Share via


DataFunctions.ConvertStringToCurrency Method (PIA)

Use this method to convert a string representation of a monetary value into a currency object, based on the specified locale and currency symbol.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Function ConvertStringToCurrency(vtMoneyString As Object,
 Optional vtLocale As Object,
 Optional vtCurrencySymbol As Object) As Object

[C#]

using Microsoft.CommerceServer.Interop;
…
public object ConvertStringToCurrency(objectvtMoneyString,
  objectvtLocale,
  objectvtCurrencySymbol);

Parameters

[Visual Basic .NET]

  • vtMoneyString
    An Object that contains the currency string to convert.
  • vtLocale
    An Object that specifies the locale to use when converting the string to a currency Object. If this parameter is not specified, the value of the Locale property of the DataFunctions object is used.
  • vtCurrencySymbol
    An Object that contains the currency symbol to expect when converting the currency string. If this parameter is not specified, the value of the CurrencySymbol property of the DataFunctions object is used.

[C#]

  • vtMoneyString
    An object that contains the currency string to convert.
  • vtLocale
    An object that contains the locale to be used when converting the string to a currency object. If you want the value of the Locale property of the DataFunctions object to be used, pass Type.Missing for this parameter.
  • vtCurrencySymbol
    An object that contains the currency symbol to expect when converting the currency string. If you want the value of the CurrencySymbol property of the DataFunctions object to be used, pass Type.Missing for this parameter.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an Object used to return the string representation of the converted monetary value.

[C#] This method returns an object containing the string representation of the converted monetary value. This will be set to null if the monetary value string is not valid.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

Example

[Visual Basic .NET]

Dim Result As Object
Dim Amount As Object
' vtAmount is a string representation of a monetary value 
DataFunctions df = New DataFunctions()
' Set to USA
df.Locale = 1033
Result = df.ConvertStringtoCurrency(vtAmount)
Response.Write("USA: " & Result & "<P>")

[C#]

No example available.

Requirements

Namespace: Microsoft.CommerceServer.Interop

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsasphelplib (in mscsasphelplib.dll)

See Also

DataFunctions Class

DataFunctions.Locale

DataFunctions.LocalizeCurrency

DataFunctions.ConvertMoneyStringToNumber

Copyright © 2005 Microsoft Corporation.
All rights reserved.