Code to Manipulate and Display Euro Values

The purpose of this example is to convert currency information from dollars to French Francs. In this example, you create an Active Server Pages (ASP) page that creates a EuroDisplay object, initializes it to set the Base Currency Symbol to "$", the Base Locale to the locale for the US, the Alternate Currency Symbol to "FF", the Alternate Locale to France, and the conversion rate equal to $ 1.00 = 2 FF. The example then converts 100 units of the Base Currency to Alternate Currency units; $100 will convert to 200 Francs.

  1. Instantiate the EuroDisplay object. Note that this line of code is usually found in the Global.asa file.

    Dim EuroDisplay, Result
    Set oEuroDisplay= Server.CreateObject("Commerce.EuroDisplay")
    
  2. Initialize the EuroDisplay object. Note that this line of code is usually found in the Global.asa file. This code will initialize the object by setting the Base Currency Symbol to "$", the Base Locale to the locale for the US, the Alternate Currency Symbol to "FF", the Alternate Locale to France, and the conversion rate equal to $ 1.00 = 2 FF.

    oEuroDisplay.Initialize("$", 1033, "FF", 1036, 2)
    
  3. Convert $ 100 to FF 200.

    cyAltCurrency = oEuroDisplay.ConvertMoney(100)
    
  4. Write the converted value to the page.

    Response.Write "Converted $100 from $ to FF ($1 = 2FF) : " _
                   & cyAltCurrency
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.