Click here to Skip to main content
Click here to Skip to main content

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 -->

Introduction

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
    public:
        //Dialog Data
    	//{{AFX_DATA(CNumericEditDlg)
    	enum { IDD = IDD_NUMERICEDIT_DIALOG };
    	CXrNumericEdit	m_ctrlPositiveValue;

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

void CNumericEditDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CNumericEditDlg)
    DDX_Text(pDX, IDC_POSITIVE_SAMPLE, m_dbPositiveValue);
	...
	//}}AFX_DATA_MAP
}

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

License

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

Share

About the Author

ramarez
Web Developer
Cuba Cuba
No Biography provided

Comments and Discussions

 
GeneralOh, my god! No Any Note Pinmemberfishyoungman15-Jan-13 15:51 
GeneralNegative value flaws PinmemberRaul Sobon19-Dec-07 19:17 
GeneralA Bug! PinmemberAli Khanlarkhani1-Dec-07 21:10 
GeneralCreating the DLL Pinmemberkevinlkingma22-Nov-06 2:46 
GeneralLimitText( nMax ) is invalid Pinmemberallehiman30-May-06 18:19 
Questioncan I mention your name in my app? PinmemberMihai Moga11-Apr-06 23:01 
GeneralRegional Settings PinmemberJDonovan20-Nov-03 13:38 
There are actually a couple of bugs when the format is set to where the decimal value is another other than a period '.', both on displaying and entering the data. On the display side, supposing you have say a COMMA set for the decimal value in the regional settings, then no values beyond the decimal point are displayed, only 0. On the entry side, it is impossible to enter ',' as the decimal point. I've managed to get all of these items fixed with several small patches throughout the code, if anyone is interested drop me an email (see my profile settings). This really is a very, very nice class.
 
- Jeff Donovan
 

 

GeneralRe: Regional Settings PinmemberMátyásföldi Imre1-Oct-07 23:24 
GeneralError with Buddy Control PinmemberJDonovan20-Nov-03 5:45 
GeneralThere is also a bug... Pinmembersoftyan8-Oct-03 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web01 | 2.8.141022.2 | Last Updated 3 Dec 2001
Article Copyright 2001 by ramarez
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid