Click here to Skip to main content
15,867,488 members
Articles / Programming Languages / C#

Yet Another Custom Currency Box

Rate me:
Please Sign up or sign in to vote.
2.85/5 (14 votes)
23 May 2009CPOL 54.6K   1.1K   24   14
Control that only allows numeric inputs
Sample Image - CurrencyBox.gif

Introduction

Trying to make my first custom control, I decided to build a textbox that will only allow numeric inputs. So I searched on the internet and found a very good control (NumericBox). I try to reproduce it to include it in my new personal custom controls library.

Help

  1. Use "," or "." to put the cursor before or after a decimal separator.
  2. "-" if enabled negative numbers add a minus sign.
  3. "+" Convert negative number to positive.
  4. BackSpace, erase the integer part of the number.
  5. Del, erase the decimal part of the number.

Thanks to

  • ProSoft for the great idea

Update

  • 24/05/2009: Enhancement
    • Added MaxValue and MinValue properties
    • Added ShowThousand separator property
  • 28/01/2007: Fixed Bugs
    • Deleting a number with backspace, the control eliminates two numbers

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Spain Spain
Graduado de Ingenieria Mecánica en la Cujae (2001),
Universidad de la Habana, Cuba

Comments and Discussions

 
GeneralBut it's in C# Code not C++ Pin
Nacereddine29-Jan-07 1:20
professionalNacereddine29-Jan-07 1:20 
GeneralThank you! Pin
MCAST7626-Jan-07 7:12
MCAST7626-Jan-07 7:12 
GeneralRe: Thank you! Pin
Juan Manuel Elosegui28-Jan-07 4:12
Juan Manuel Elosegui28-Jan-07 4:12 
GeneralRe: Thank you! Pin
MCAST7628-Jan-07 13:52
MCAST7628-Jan-07 13:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.