Friday, May 09, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com

 FarPoint Europe (UK)
 +44 (0) 1798 812 372

 salesEurope@fpoint.com

     
 »Input Pro »Product Tour » fpCurrency

Previous fpCurrency Control Next

The fpCurrency control displays monetary data and makes it easy to type and edit monetary values. The fpCurrency control formats currency values with a decimal character and a currency symbol. You can change the format for negative values, the number of decimal places, and the separator character.

By default, the fpCurrency control checks each character as it is typed and blocks invalid characters. It validates the provided data when the control loses the focus. You can also add buttons to an fpCurrency control to customize user interaction. In Visual Basic, you can bind the fpCurrency control to numeric, currency, and text database fields.

Setting and Returning Currency Values | Formatting Currency Values | Providing Buttons | Validating Currency Data | Displaying a Separator Character | Formatting Decimal Values | Working with Negative Numbers | Customizing User Entry

  Back to Top
 Setting and Returning Currency Values
    You can set the value by using the Text property.

To return the value as a string including the formatting, such as the currency symbol, use the Text property. To return just the value as a string with no formatting but maintain its precision, use the UnFmtText property. To return just the value as a string with no formatting and not maintain its precision, use the Value property. To return the value as a number with no formatting but maintain its precision, use the DoubleValue method.

 Back to Top
 Formatting Currency Values
   You can customize the currency symbol and its placement using the CurrencySymbol and CurrencyPlacement properties. By default, the fpCurrency control determines the currency symbol and placement using the international or regional Windows settings. However, you can specify that the control display any currency symbol and any of the currency placements illustrated to the right.

  Back to Top
 Providing Buttons
   The fpCurrency control can display buttons to let the user quickly change the value in the control without typing. You can choose which type of buttons to display and the amount by which the value of the control changes when the user clicks a button.

A commonly used button style for the fpCurrency control is the spin button. By default, spin buttons increment and decrement the value of the control. You can specify the amount by which the integer and decimal values are changed.

  Back to Top
  Validating Currency Data
NOTE: Be sure to read the Customizing User Entry section below for information on validation of data while being entered by the user.

   When the fpCurrency control loses the focus, it checks the value of the control to see whether it is valid. Valid values are defined as currency values, and values are limited by the settings of the MinValue and MaxValue properties. If an invalid value is received, an InvalidData event occurs after the control loses the focus.

You can change the fpCurrency control's appearance to reflect that it has received invalid data. In addition, you can specify whether and how invalid data is displayed.

You can specify whether the control allows the Null value. If the control allows the Null value as a valid value, the control is blank when it contains the Null value, and it displays as its background color the color specified by the NullColor property. Otherwise, the control displays its default value, "$0.00". You can specify that the control does not perform any data validation when it loses the focus by setting the AllowModifiedFlag property to False, but you should do so with caution.

  Back to Top
 Displaying a Separator Character
   You can group digits using a separator character to assist readability. For example, it is common in the United States to represent large numbers with commas separating every three digits to show multiples of one thousand.

By default, the fpCurrency control does not display a separator character. If you format the control to display a separator character, but do not specify the character to display, the control displays the separator character specified by the international or regional Windows settings.

  Back to Top
 Formatting Decimal Values
   You can configure the control to display decimal values with formatting to assist readability and consistency. You can specify the decimal symbol, the number of digits in the decimal value, and whether placeholding zeros are displayed. In addition, values less than 1.0 and greater than -1.0 can display a zero in the integer value.

By default, the fpCurrency control determines the decimal symbol, the number of decimal digits, and whether the control displays a leading zero using the international or regional Windows settings.

  Back to Top
 Working with Negative Numbers
   You can customize the format for displaying negative numbers. You can also let the user toggle the control's value between positive and negative by pressing the hyphen key or the minus key on the numeric keypad.

By default, the fpCurrency control determines how to format negative currency values using the international or regional Windows settings. However, you can specify that the control display any of the formats illustrated in the following figure.

  Back to Top
 Customizing User Entry
   By default, user entry is restricted because the fpCurrency control checks each character as the user types it or when the user pastes data into the control. If the user tries to type or paste a character that is not valid for the control, the control does not accept the character, and a UserError event occurs. You can specify that the control beeps when the user types or pastes an invalid character. You can also restrict user entry by making the control read-only or static.

If you prefer, you can configure the control so it does not check each character as it is supplied, and lets the user type or paste invalid characters. Valid characters for the fpCurrency control are numbers, a currency symbol, and a decimal symbol (though the control can supply additional formatting characters, such as a separator character). Whether or not the data typed or pasted by the user is checked as it is supplied, it is validated when the control loses the focus, as is data supplied in code or from a database.

Previous fpCurrency Control Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)


Input Pro Tour
fpBoolean Control
fpCurrency Control
fpDateTime Control
fpDoubleSingle Control
fpLongInteger Control
fpMask Control
fpMemo Control
fpText Control
Rate this Tour

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.