Solved

Allow only numbers in an edit control

Posted on 1998-05-26
3
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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