This article's download is for AVR for .NET version 14.x or 15.x. To use it with earlier versions you'll need to cut and paste the code (but otherwise the code should work on earlier versions).

Although ASNA Visual RPG for .NET works with Microsoft's  masked input control, that control's behavior is a little finicky and its most effective with fixed-size inputs only (eg, a US social security number). It doesn't work well for entering numeric values of varying lengths.

This article provides three subroutines you can add to your Windows form projects that pumps up the decimal numeric input capabilities of the standard System.Windows.Forms.TextBox.

The features this code adds are:

  • Numeric-only input (no letters are allowed.)
  • A single minus sign (-) may be entered, but it must be at the start of the number.
  • The decimal length is set explicitly, and enforced, for each TextBox.
  • A single decimal point is allowed (if the decimal length is not zero).
  • Decimal digits input is limited to the number of decimals specified (or inhibited if the decimal length is zero).
  • Special keyboard control keystrokes (such as the tab and backspace key) are allowed
  • The decimal separator is the default culture-specific decimal separator.

Read the full technical article on ASNA.com.



Please login or create an account to post comments.