Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Advanced Numeric Edit Control

0.00/5 (No votes)
2 Dec 2001 1  
An edit control that provides formatting and validation number

Sample Image - XRNumericEditCtrl.jpg

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