Solved

Allow only numbers in an edit control

Posted on 1998-05-26
3
179 Views
Last Modified: 2013-11-20
I have a edit control that I only want to accept numbers.  I have subclassed this control and captured the WM_KEYDOWN events but how do I keep the edit from displaying anything but numbers??  I used Spy++ but I didn't see any kind of paint messages sent when I typed in text.
0
Comment
Question by:dlbrown051198
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
bsimser earned 50 total points
ID: 1315108
In the resource editor, open the properties of the CEdit control you're using and check the 'numbers' checkbox. Also, create a variable of a control type via the wizard for any dialog that uses this control and set it to your subclassed version.
0
 

Author Comment

by:dlbrown051198
ID: 1315109
I do not see a "number" option under the resource editor.  Also this is a, dare I say, 16 bit app.
0
 
LVL 1

Expert Comment

by:bsimser
ID: 1315110
What version of VC are you using? I assume 4.xx but I don't have that. In 5.0 it's in the properties dialog of the control on one of the tab sheets. Not sure if it's available in 4 but it should be.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now