Solved

Allow only numbers in an edit control

Posted on 1998-05-26
3
178 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
configuration management 2 100
dog bark java program 15 82
mapBully challenge 6 93
Making an alias 7 54
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…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

13 Experts available now in Live!

Get 1:1 Help Now