Click here to Skip to main content
12,303,940 members (73,971 online)
Click here to Skip to main content
Add your own
alternative version


39 bookmarked

Advanced Numeric Edit Control

, 2 Dec 2001
Rate this:
Please Sign up or sign in to vote.
An edit control that provides formatting and validation number
<!-- Download Links --> <!-- Article image -->

Sample Image - XRNumericEditCtrl.jpg

<!-- Add the rest of your HTML here -->


The CXrNumericEdit class is derived from the normal CEdit class.

To use this class

  • Add the CXrNumericEdit source file to project.
  • Add standard edit control
  • Change CEdit class to CXrNumericEdit
        //Dialog Data
    	CXrNumericEdit	m_ctrlPositiveValue;

To get and set the value in the CXrNumericEdit control use the DDX functions.

void CNumericEditDlg::DoDataExchange(CDataExchange* pDX)
    DDX_Text(pDX, IDC_POSITIVE_SAMPLE, m_dbPositiveValue);

Thanks to

  • Randy More for 'All you ever wanted to know about the Clipboard'
  • Ian J Hart by Number, Currency, Percentage Edit Control
  • Dundas Software for the Masked Edit Control


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Cuba Cuba
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralOh, my god! No Any Note Pin
fishyoungman15-Jan-13 15:51
memberfishyoungman15-Jan-13 15:51 
GeneralNegative value flaws Pin
Raul Sobon19-Dec-07 19:17
memberRaul Sobon19-Dec-07 19:17 
GeneralA Bug! Pin
Ali Khanlarkhani1-Dec-07 21:10
memberAli Khanlarkhani1-Dec-07 21:10 
GeneralCreating the DLL Pin
kevinlkingma22-Nov-06 2:46
memberkevinlkingma22-Nov-06 2:46 
GeneralLimitText( nMax ) is invalid Pin
allehiman30-May-06 18:19
memberallehiman30-May-06 18:19 
Questioncan I mention your name in my app? Pin
Mihai Moga11-Apr-06 23:01
memberMihai Moga11-Apr-06 23:01 
GeneralRegional Settings Pin
JDonovan20-Nov-03 13:38
memberJDonovan20-Nov-03 13:38 
GeneralRe: Regional Settings Pin
Mátyásföldi Imre1-Oct-07 23:24
memberMátyásföldi Imre1-Oct-07 23:24 
GeneralError with Buddy Control Pin
JDonovan20-Nov-03 5:45
memberJDonovan20-Nov-03 5:45 
This is a great class and thank you! There is a small error in that if the edit control has an attached buddy control, the keyboard arrows will now no longer work with the spinner. The solution is to:

1) In the xrnumericedit.cpp file, goto the function "OnKeyDown()", and remark out the VK_DOWN and VK_UP cases.

2) In the same function, same case, add a default handler to pass the message on to the base control, as in:

CEdit::OnKeyDown(nChar, nRepCnt, nFlags);

That will fix it and allow the keyboard arrows to again control the spinner.

Thanks again for providing the class,


- Jeff Donovan

GeneralThere is also a bug... Pin
softyan8-Oct-03 0:03
membersoftyan8-Oct-03 0:03 
GeneralCan't Properly Set Sel Pin
forrest.mao28-May-03 17:30
memberforrest.mao28-May-03 17:30 
GeneralSuggestion Pin
Stlan27-Jan-03 21:12
memberStlan27-Jan-03 21:12 
QuestionA bug? Pin
Anonymous9-Oct-02 6:59
sussAnonymous9-Oct-02 6:59 
GeneralCreate Pin
Anonymous22-Feb-02 2:50
memberAnonymous22-Feb-02 2:50 
GeneralRe: Create Pin
jmarcos10-Sep-02 19:16
memberjmarcos10-Sep-02 19:16 
GeneralMissing header Pin
John P. Curtis3-Dec-01 19:17
memberJohn P. Curtis3-Dec-01 19:17 
GeneralRe: Missing header Pin
thierry3-Dec-01 21:30
memberthierry3-Dec-01 21:30 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160530.1 | Last Updated 3 Dec 2001
Article Copyright 2001 by ramarez
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid