Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Allow only numbers in an edit control

Posted on 1998-05-26
3
Medium Priority
?
186 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 100 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

Industry Leaders: 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

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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

636 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